summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/emcc.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/emcc.lua
parentc96e777d90a4cec5941896680191f50e47e0d247 (diff)
improve optimize for emcc
Diffstat (limited to 'xmake/modules/core/tools/emcc.lua')
-rw-r--r--xmake/modules/core/tools/emcc.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/emcc.lua b/xmake/modules/core/tools/emcc.lua
index a443f43f6..8c08e4b0d 100644
--- a/xmake/modules/core/tools/emcc.lua
+++ b/xmake/modules/core/tools/emcc.lua
@@ -21,6 +21,22 @@
-- inherit gcc
inherit("gcc")
+-- make the optimize flag
+--
+-- same options must be used at compile and link, @see https://github.com/xmake-io/xmake/issues/2455
+-- https://emscripten.org/docs/compiling/Building-Projects.html?highlight=optimization#building-projects-optimizations
+function nf_optimize(self, level)
+ local maps = {
+ none = "-O0"
+ , fast = "-O1"
+ , faster = "-O2"
+ , fastest = "-O3"
+ , smallest = "-Os"
+ , aggressive = "-O3"
+ }
+ return maps[level]
+end
+
-- make the strip flag
function nf_strip(self, level)
end