diff options
| author | ruki <[email protected]> | 2017-02-21 13:27:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-02-21 13:27:22 +0800 |
| commit | 60bce69c3f3be74e0de627d337b9b39e24aa45b8 (patch) | |
| tree | be7ae576eba06738e34b217f676464309afb00e8 /xmake/tools | |
| parent | 4d635c3a48b87f92866ebfbc229558becf896158 (diff) | |
impl dmd compile and link
Diffstat (limited to 'xmake/tools')
| -rwxr-xr-x | xmake/tools/dmd.lua | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/xmake/tools/dmd.lua b/xmake/tools/dmd.lua index 3be2f5d12..f0f3a2373 100755 --- a/xmake/tools/dmd.lua +++ b/xmake/tools/dmd.lua @@ -55,25 +55,28 @@ end function nf_includedir(dir) -- make it - return "-I " .. dir + return "" end -- make the linkdir flag function nf_linkdir(dir) -- make it - return "-L " .. dir + return "" end -- make the link command function linkcmd(objectfiles, targetkind, targetfile, flags) + -- kinds + local kinds = + { + static = " -lib" + , shared = " -shared" + } + -- make it - if targetkind == "static" then - return format("%s tool pack %s %s %s", _g.shellname, flags, targetfile, objectfiles) - else - return format("%s tool link %s -o %s %s", _g.shellname, flags, targetfile, objectfiles) - end + return format("%s%s %s -of%s %s", _g.shellname, kinds[targetkind] or "", flags, targetfile, objectfiles) end -- link the target file @@ -90,7 +93,7 @@ end function compcmd(sourcefiles, objectfile, flags) -- make it - return format("%s %s -of%s %s", _g.shellname, flags, objectfile, table.concat(table.wrap(sourcefiles), " ")) + return format("%s -c %s -of%s %s", _g.shellname, flags, objectfile, table.concat(table.wrap(sourcefiles), " ")) end -- complie the source file @@ -114,7 +117,7 @@ function check(flags) io.write(sourcefile, "void main() {\n}") -- check it - os.run("%s %s -of%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile) + os.run("%s -c %s -of%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile) -- remove files os.rm(objectfile) |
