summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-05-23 22:21:16 +0800
committerruki <[email protected]>2019-05-23 08:07:37 +0800
commit7434ac208724ea5840e32040fda9601feb4dd722 (patch)
tree01354815e47eb7dd2e57909024432d57576a81ef
parentaf7907d7adc0c60930477730876f0ed74d3a9f5a (diff)
translate path for gcc and cl
-rw-r--r--xmake/core/base/utils.lua3
-rw-r--r--xmake/core/sandbox/modules/os.lua2
-rw-r--r--xmake/core/sandbox/modules/try.lua23
-rw-r--r--xmake/modules/core/tools/cl.lua2
-rw-r--r--xmake/modules/core/tools/gcc.lua7
-rw-r--r--xmake/modules/core/tools/link.lua2
6 files changed, 33 insertions, 6 deletions
diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua
index 3bd265ce3..f6e56b15f 100644
--- a/xmake/core/base/utils.lua
+++ b/xmake/core/base/utils.lua
@@ -197,6 +197,9 @@ function utils.trycall(script, traceback, ...)
end
if type(errors) == "table" then
setmetatable(errors, { __tostring = function (self)
+ if self.errors then
+ return self.errors
+ end
return string.serialize(self)
end
})
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 55c59d6d5..c1a9a3510 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -348,6 +348,7 @@ function sandbox_os.iorun(cmd, ...)
errors = outdata or ""
end
os.raise(errors)
+-- os.raise({errors = errors, stderr = errdata, stdout = outdata})
end
-- ok
@@ -368,6 +369,7 @@ function sandbox_os.iorunv(program, argv, opt)
errors = outdata or ""
end
os.raise(errors)
+-- os.raise({errors = errors, stderr = errdata, stdout = outdata})
end
-- ok
diff --git a/xmake/core/sandbox/modules/try.lua b/xmake/core/sandbox/modules/try.lua
index cf0098375..b0b940be2 100644
--- a/xmake/core/sandbox/modules/try.lua
+++ b/xmake/core/sandbox/modules/try.lua
@@ -86,7 +86,28 @@ function sandbox_try._traceback(errors)
return results
end
--- try
+-- local ok = try
+-- {
+-- function ()
+-- raise("errors")
+-- raise({errors = "xxx", xxx = "", yyy = ""})
+-- return true
+-- end,
+-- catch
+-- {
+-- function (errors)
+-- print(errors)
+-- if errors then
+-- print(errors.xxx)
+-- end
+-- end
+-- },
+-- finally
+-- {
+-- function (ok, result_or_errors)
+-- end
+-- }
+-- }
function sandbox_try.try(block)
-- get the try function
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 08a17ff8e..4464b6ca1 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -234,7 +234,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return "-I" .. os.args(path.translate(dir))
end
-- make the c precompiled header flag
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 99daa755a..d208f1fcd 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -233,7 +233,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return "-I" .. os.args(path.translate(dir))
end
-- make the link flag
@@ -248,11 +248,12 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(dir)
+ return "-L" .. os.args(path.translate(dir))
end
-- make the rpathdir flag
function nf_rpathdir(self, dir)
+ dir = path.translate(dir)
if self:has_flags("-Wl,-rpath=" .. dir, "ldflags") then
return "-Wl,-rpath=" .. os.args(dir:gsub("@[%w_]+", function (name)
local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
@@ -270,7 +271,7 @@ end
-- make the frameworkdir flag
function nf_frameworkdir(self, frameworkdir)
- return "-F " .. os.args(frameworkdir)
+ return "-F " .. os.args(path.translate(frameworkdir))
end
-- make the c precompiled header flag
diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua
index cf6596fce..715c3e78a 100644
--- a/xmake/modules/core/tools/link.lua
+++ b/xmake/modules/core/tools/link.lua
@@ -86,7 +86,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-libpath:" .. os.args(dir)
+ return "-libpath:" .. os.args(path.translate(dir))
end
-- make the link arguments list