summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-12 14:02:45 +0800
committerruki <[email protected]>2017-07-12 14:02:51 +0800
commit693619f971581f9b7bc66fcdb1ef65d01aa002e5 (patch)
treeeced75dee7ccc9f998e1c69d14d7fbd0aaa117ec
parentb470ddf3d3723a700a97f73f8599696d21198bfb (diff)
fix swiftc and on_load environment
-rw-r--r--xmake/core/project/project.lua13
-rw-r--r--xmake/modules/core/tools/swiftc.lua38
2 files changed, 29 insertions, 22 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index f16d61c5d..5195df00b 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -41,6 +41,7 @@ local option = require("project/option")
local package = require("project/package")
local deprecated_project = require("project/deprecated/project")
local platform = require("platform/platform")
+local environment = require("platform/environment")
local language = require("language/language")
local sandbox_os = require("sandbox/modules/os")
@@ -434,19 +435,25 @@ function project.load()
-- save targets
project._TARGETS = targets
+ -- enter toolchains environment
+ environment.enter("toolchains")
+
-- on load for each target
for _, target in pairs(targets) do
local on_load = target:script("load")
if on_load then
ok, errors = sandbox.load(on_load, target)
if not ok then
- return false, errors
+ break
end
end
end
- -- ok
- return true
+ -- leave toolchains environment
+ environment.leave("toolchains")
+
+ -- ok?
+ return ok, errors
end
-- get the given target
diff --git a/xmake/modules/core/tools/swiftc.lua b/xmake/modules/core/tools/swiftc.lua
index c1b9aad93..b7641128c 100644
--- a/xmake/modules/core/tools/swiftc.lua
+++ b/xmake/modules/core/tools/swiftc.lua
@@ -74,12 +74,12 @@ function nf_strip(self, level)
-- the maps
local maps =
{
- debug = "-Xlinker -S"
- , all = "-Xlinker -s"
+ debug = {"-Xlinker", "-S"}
+ , all = {"-Xlinker", "-s"}
}
-- make it
- return maps[level] or ""
+ return maps[level]
end
-- make the symbol flag
@@ -92,7 +92,7 @@ function nf_symbol(self, level)
}
-- make it
- return maps[level] or ""
+ return maps[level]
end
-- make the warning flag
@@ -101,15 +101,15 @@ function nf_warning(self, level)
-- the maps
local maps =
{
- none = "-w"
- , less = "-W1"
- , more = "-W3"
- , all = "-Wall"
- , error = "-Werror"
+ none = "-w"
+ , less = "-W1"
+ , more = "-W3"
+ , all = "-Wall"
+ , error = "-Werror"
}
-- make it
- return maps[level] or ""
+ return maps[level]
end
-- make the optimize flag
@@ -127,7 +127,7 @@ function nf_optimize(self, level)
}
-- make it
- return maps[level] or ""
+ return maps[level]
end
-- make the vector extension flag
@@ -136,14 +136,14 @@ function nf_vectorext(self, extension)
-- the maps
local maps =
{
- mmx = "-mmmx"
- , sse = "-msse"
- , sse2 = "-msse2"
- , sse3 = "-msse3"
- , ssse3 = "-mssse3"
- , avx = "-mavx"
- , avx2 = "-mavx2"
- , neon = "-mfpu=neon"
+ mmx = "-mmmx"
+ , sse = "-msse"
+ , sse2 = "-msse2"
+ , sse3 = "-msse3"
+ , ssse3 = "-mssse3"
+ , avx = "-mavx"
+ , avx2 = "-mavx2"
+ , neon = "-mfpu=neon"
}
-- make it