summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-14 00:44:03 +0800
committerruki <[email protected]>2022-09-14 00:44:03 +0800
commit17aaf0c2b76c68a7b4dda70ef37df97d58dd026b (patch)
tree7a584c0908ae2a9ae2112d729dcf6fa16b8f46f5
parent1bf418b749afd4abaeaf36574569e6ac4fc4b8d9 (diff)
fix optimize flags for clang-cl
-rw-r--r--xmake/modules/core/tools/clang_cl.lua28
1 files changed, 14 insertions, 14 deletions
diff --git a/xmake/modules/core/tools/clang_cl.lua b/xmake/modules/core/tools/clang_cl.lua
index 45a4037b4..e01069223 100644
--- a/xmake/modules/core/tools/clang_cl.lua
+++ b/xmake/modules/core/tools/clang_cl.lua
@@ -92,20 +92,20 @@ end
-- make the optimize flag
function nf_optimize(self, level)
-
- -- the maps
- local maps =
- {
- none = "-O0"
- , fast = "-O1"
- , faster = "-O2"
- , fastest = "-O3"
- , smallest = "-Os"
- , aggressive = "-Ofast"
- }
-
- -- make it
- return maps[level]
+ -- only for source kind
+ local kind = self:kind()
+ if language.sourcekinds()[kind] then
+ local maps =
+ {
+ none = "-O0"
+ , fast = "-O1"
+ , faster = "-O2"
+ , fastest = "-O3"
+ , smallest = "-Oz" -- smaller than -Os
+ , aggressive = "-Ofast"
+ }
+ return maps[level]
+ end
end
-- compile the source file