summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-14 00:44:30 +0800
committerruki <[email protected]>2022-09-14 00:44:30 +0800
commit03766e4cf5df0cedd9f18f72b089dfac61a82821 (patch)
tree2130681619ad99136de1523a426e4f03a7d83d0a
parent17aaf0c2b76c68a7b4dda70ef37df97d58dd026b (diff)
improve optimize for cl
-rw-r--r--xmake/modules/core/tools/cl.lua22
1 files changed, 13 insertions, 9 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 506f9e6d7..177b97669 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -158,15 +158,19 @@ end
-- make the optimize flag
function nf_optimize(self, level)
- local maps =
- {
- none = "-Od"
- , faster = "-O2"
- , fastest = "-Ox -fp:fast"
- , smallest = "-O1 -GL" -- /GL and (/OPT:REF is on by default in linker), we need enable /ltcg
- , aggressive = "-Ox -fp:fast"
- }
- return maps[level]
+ -- only for source kind
+ local kind = self:kind()
+ if language.sourcekinds()[kind] then
+ local maps =
+ {
+ none = "-Od"
+ , faster = "-Ox"
+ , fastest = "-O2 -fp:fast"
+ , smallest = "-O1 -GL" -- /GL and (/OPT:REF is on by default in linker), we need enable /ltcg
+ , aggressive = "-O2 -fp:fast"
+ }
+ return maps[level]
+ end
end
-- make vs runtime flag