summaryrefslogtreecommitdiff
path: root/xmake/scripts/base
diff options
context:
space:
mode:
authorruki <[email protected]>2015-11-27 09:13:36 +0800
committerruki <[email protected]>2015-11-27 09:13:36 +0800
commit8b470280735545982a32ead11c6d9f9245a65dea (patch)
treedafb1c0c13d6b1e64cdfcb1da009955183cde30f /xmake/scripts/base
parent834f71c6e70e62c719060d0cf5bed34fe715fb16 (diff)
fix object file path bug
Diffstat (limited to 'xmake/scripts/base')
-rw-r--r--xmake/scripts/base/rule.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/xmake/scripts/base/rule.lua b/xmake/scripts/base/rule.lua
index b8695d418..8e1deab73 100644
--- a/xmake/scripts/base/rule.lua
+++ b/xmake/scripts/base/rule.lua
@@ -148,8 +148,22 @@ function rule.objectfiles(target_name, target, sourcefiles, buildir)
-- make object file
local objectfile = string.format("%s/%s/%s/%s", objectdir, target_name, path.directory(sourcefile), rule.filename(path.basename(sourcefile), "object"))
+ -- translate path
+ --
+ -- .e.g
+ --
+ -- src/xxx.c
+ -- project/xmake.lua
+ -- build/.objs
+ --
+ -- objectfile: project/build/.objs/xxxx/../../xxx.c will be out of range for objectdir
+ --
+ -- we need replace '..' to '__' in this case
+ --
+ objectfile = (path.translate(objectfile):gsub("%.%.", "__"))
+
-- save it
- objectfiles[i] = path.translate(objectfile)
+ objectfiles[i] = objectfile
i = i + 1
end