summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-05-07 21:52:28 +0800
committerruki <[email protected]>2023-05-07 21:52:44 +0800
commit21e5179ead94dc8e3f9721a0af3ef3d6b0354295 (patch)
treee4973363d2f0f0823067752460fd9a43512e8659
parent047328cc1c795ee03275887f15012412bbfec978 (diff)
fix dependfile path #3715
-rw-r--r--xmake/core/project/target.lua25
1 files changed, 12 insertions, 13 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 092c2b7fb..182fabb14 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1143,9 +1143,12 @@ function _instance:autogenfile(sourcefile, opt)
-- we need replace '..' to '__' in this case
--
if path.is_absolute(relativedir) and os.host() == "windows" then
- -- remove C:\\ and whitespaces
+ -- remove C:\\ and whitespaces and fix long path issue
-- e.g. C:\\Program Files (x64)\\xxx\Windows.h
- -- @see https://github.com/xmake-io/xmake/issues/3021
+ --
+ -- @see
+ -- https://github.com/xmake-io/xmake/issues/3021
+ -- https://github.com/xmake-io/xmake/issues/3715
relativedir = hash.uuid4(relativedir):gsub("%-", ""):lower()
end
relativedir = relativedir:gsub("%.%.", "__")
@@ -1796,7 +1799,13 @@ function _instance:dependfile(objectfile)
relativedir = origindir
end
if path.is_absolute(relativedir) and os.host() == "windows" then
- relativedir = relativedir:gsub(":[\\/]*", '\\') -- replace C:\xxx\ => C\xxx\
+ -- remove C:\\ and whitespaces and fix long path issue
+ -- e.g. C:\\Program Files (x64)\\xxx\Windows.h
+ --
+ -- @see
+ -- https://github.com/xmake-io/xmake/issues/3021
+ -- https://github.com/xmake-io/xmake/issues/3715
+ relativedir = hash.uuid4(relativedir):gsub("%-", ""):lower()
end
-- originfile: project/build/.objs/xxxx/../../xxx.c will be out of range for objectdir
@@ -1812,25 +1821,15 @@ end
-- get the dependent include files
function _instance:dependfiles()
-
- -- get source batches
local sourcebatches, modified = self:sourcebatches()
-
- -- cached? return it directly
if self._DEPENDFILES and not modified then
return self._DEPENDFILES
end
-
- -- get dependent files from source batches
local dependfiles = {}
for _, sourcebatch in pairs(self:sourcebatches()) do
table.join2(dependfiles, sourcebatch.dependfiles)
end
-
- -- cache it
self._DEPENDFILES = dependfiles
-
- -- ok?
return dependfiles
end