From db62122ed2aab5ea823ea80617e673bfedfeb28b Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 15 Jun 2022 00:08:37 +0800 Subject: improve optimize for emcc --- xmake/modules/core/tools/fpc.lua | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'xmake/modules/core/tools/fpc.lua') diff --git a/xmake/modules/core/tools/fpc.lua b/xmake/modules/core/tools/fpc.lua index 98b746c8a..57af7a45b 100644 --- a/xmake/modules/core/tools/fpc.lua +++ b/xmake/modules/core/tools/fpc.lua @@ -22,6 +22,7 @@ import("core.base.option") import("core.project.config") import("core.project.project") +import("core.language.language") -- init it function init(self) @@ -32,15 +33,19 @@ end -- make the optimize flag function nf_optimize(self, level) - local maps = - { - none = "-O-" - , fast = "-O1" - , fastest = "-O3" - , smallest = "-O2" - , aggressive = "-O4" - } - return maps[level] + -- only for source kind + local kind = self:kind() + if language.sourcekinds()[kind] then + local maps = + { + none = "-O-" + , fast = "-O1" + , fastest = "-O3" + , smallest = "-O2" + , aggressive = "-O4" + } + return maps[level] + end end -- make the strip flag -- cgit v1.3.1