diff options
| author | ruki <[email protected]> | 2023-01-29 22:17:44 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-01-29 22:18:08 +0800 |
| commit | d6f64cf2a51e2225afd292167e2baba6250233d0 (patch) | |
| tree | c88e57ade26172da5371402572e717ce43e285ac /xmake/modules/core/tools/ldc2.lua | |
| parent | 0e533c28f85bf23b57a08709c9a845efad16ff45 (diff) | |
improve ldc
Diffstat (limited to 'xmake/modules/core/tools/ldc2.lua')
| -rw-r--r-- | xmake/modules/core/tools/ldc2.lua | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/xmake/modules/core/tools/ldc2.lua b/xmake/modules/core/tools/ldc2.lua index 86c821252..3a2dbf160 100644 --- a/xmake/modules/core/tools/ldc2.lua +++ b/xmake/modules/core/tools/ldc2.lua @@ -20,6 +20,7 @@ -- imports inherit("dmd") +import("core.language.language") -- init it function init(self) @@ -37,20 +38,28 @@ end -- make the optimize flag function nf_optimize(self, level) local maps = { - fast = "-O" - , faster = {"-O", "--release"} - , fastest = {"-O", "--release", "--boundscheck=off"} - , smallest = {"-O", "--release", "--boundscheck=off"} - , aggressive = {"-O", "--release", "--boundscheck=off"} + none = "--O0" + , fast = "--O1" + , faster = {"--O2", "--release"} + , fastest = {"--O3", "--release", "--boundscheck=off"} + , smallest = {"--Oz", "--release", "--boundscheck=off"} + , aggressive = {"--O4", "--release", "--boundscheck=off"} } return maps[level] end -- make the symbol flag function nf_symbol(self, level) - local maps = { - debug = "-g --d-debug" - } - return maps[level] + local kind = self:kind() + if language.sourcekinds()[kind] then + local maps = _g.symbol_maps + if not maps then + maps = { + debug = {"-g", "--d-debug"} + , hidden = "-fvisibility=hidden" + } + _g.symbol_maps = maps + end + return maps[level .. '_' .. kind] or maps[level] + end end - |
