summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/ldc2.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-29 22:17:44 +0800
committerruki <[email protected]>2023-01-29 22:18:08 +0800
commitd6f64cf2a51e2225afd292167e2baba6250233d0 (patch)
treec88e57ade26172da5371402572e717ce43e285ac /xmake/modules/core/tools/ldc2.lua
parent0e533c28f85bf23b57a08709c9a845efad16ff45 (diff)
improve ldc
Diffstat (limited to 'xmake/modules/core/tools/ldc2.lua')
-rw-r--r--xmake/modules/core/tools/ldc2.lua29
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
-