diff options
| author | ruki <[email protected]> | 2022-10-07 23:06:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-10-07 23:06:33 +0800 |
| commit | 458b805a6ebac9cae0f36ac593ececd8e1717444 (patch) | |
| tree | edecbe607a3bd4fb9ce631905a6b6b2391ead832 | |
| parent | 647616f7eede6ba20ddbe40dc500fd611de4d635 (diff) | |
improve dmd
| -rw-r--r-- | xmake/modules/core/tools/dmd.lua | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/xmake/modules/core/tools/dmd.lua b/xmake/modules/core/tools/dmd.lua index e3785c680..dc5a465ee 100644 --- a/xmake/modules/core/tools/dmd.lua +++ b/xmake/modules/core/tools/dmd.lua @@ -31,10 +31,13 @@ function init(self) self:set("dcarflags", "-lib") -- init shflags - self:set("dcshflags", "-shared", "-fPIC") + self:set("dcshflags", "-shared") - -- init dcflags for the kind: shared - self:set("shared.dcflags", "-fPIC") + -- add -fPIC for shared + if not is_plat("windows", "mingw") then + self:add("dcshflags", "-fPIC") + self:add("shared.dcflags", "-fPIC") + end end -- make the optimize flag @@ -56,18 +59,18 @@ end -- make the strip flag function nf_strip(self, level) - local maps = - { - debug = "-L-S" - , all = "-L-s" - } - return maps[level] + if self:plat() ~= "windows" then + local maps = { + debug = "-L-S", + all = "-L-s" + } + return maps[level] + end end -- make the symbol flag function nf_symbol(self, level) - local maps = - { + local maps = { debug = "-g -debug" } return maps[level] @@ -109,7 +112,11 @@ end -- make the link flag function nf_link(self, lib) - return "-L-l" .. lib + if self:plat() == "windows" then + return "-L" .. lib .. ".lib" + else + return "-L-l" .. lib + end end -- make the syslink flag @@ -119,7 +126,11 @@ end -- make the linkdir flag function nf_linkdir(self, dir) - return {"-L-L" .. dir} + if self:plat() == "windows" then + return {"-L-libpath:" .. dir} + else + return {"-L-L" .. dir} + end end -- make the rpathdir flag |
