summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/swiftc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-06-15 00:08:37 +0800
committerruki <[email protected]>2022-06-14 20:12:57 +0800
commitdb62122ed2aab5ea823ea80617e673bfedfeb28b (patch)
tree8898612c00662fe41573fc2919a18b38fc9ddb6b /xmake/modules/core/tools/swiftc.lua
parentc96e777d90a4cec5941896680191f50e47e0d247 (diff)
improve optimize for emcc
Diffstat (limited to 'xmake/modules/core/tools/swiftc.lua')
-rw-r--r--xmake/modules/core/tools/swiftc.lua29
1 files changed, 15 insertions, 14 deletions
diff --git a/xmake/modules/core/tools/swiftc.lua b/xmake/modules/core/tools/swiftc.lua
index 0788635bc..948e408ab 100644
--- a/xmake/modules/core/tools/swiftc.lua
+++ b/xmake/modules/core/tools/swiftc.lua
@@ -20,6 +20,7 @@
-- imports
import("core.project.config")
+import("core.language.language")
-- init it
function init(self)
@@ -103,20 +104,20 @@ end
-- make the optimize flag
function nf_optimize(self, level)
-
- -- the maps
- local maps =
- {
- none = "-Onone"
- , fast = "-O"
- , faster = "-O"
- , fastest = "-O"
- , smallest = "-O"
- , aggressive = "-Ounchecked"
- }
-
- -- make it
- return maps[level]
+ -- only for source kind
+ local kind = self:kind()
+ if language.sourcekinds()[kind] then
+ local maps =
+ {
+ none = "-Onone"
+ , fast = "-O"
+ , faster = "-O"
+ , fastest = "-O"
+ , smallest = "-O"
+ , aggressive = "-Ounchecked"
+ }
+ return maps[level]
+ end
end
-- make the vector extension flag