diff options
| author | ruki <[email protected]> | 2017-02-22 00:04:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-02-22 00:04:47 +0800 |
| commit | 07090c9dcd4c9deb42b2f8aa47072a9f8c518d85 (patch) | |
| tree | b29b649000e0404927d67c9a68545eb4cb2d0ab5 /xmake/tools/swiftc.lua | |
| parent | 06e5d287750d029f1458f2fa2f88733238cf93eb (diff) | |
improve swfitc tool
Diffstat (limited to 'xmake/tools/swiftc.lua')
| -rw-r--r-- | xmake/tools/swiftc.lua | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/xmake/tools/swiftc.lua b/xmake/tools/swiftc.lua index 74f7e8974..f006b4c14 100644 --- a/xmake/tools/swiftc.lua +++ b/xmake/tools/swiftc.lua @@ -72,18 +72,24 @@ end -- get the property function get(name) - -- init ldflags - if not _g.ldflags then - local swift_linkdirs = config.get("__swift_linkdirs") - if swift_linkdirs then - _g.ldflags = { "-L" .. swift_linkdirs } - end - end - -- get it return _g[name] end +-- make the strip flag +function nf_strip(level) + + -- the maps + local maps = + { + debug = "-Xlinker -S" + , all = "-Xlinker -s" + } + + -- make it + return maps[level] or "" +end + -- make the symbol flag function nf_symbol(level) @@ -180,6 +186,37 @@ function nf_framework(framework) return "-framework" .. framework end +-- make the link flag +function nf_link(lib) + + -- make it + return "-l" .. lib +end + +-- make the linkdir flag +function nf_linkdir(dir) + + -- make it + return "-L" .. dir +end + +-- make the link command +function linkcmd(objectfiles, targetkind, targetfile, flags) + + -- make it + return format("%s -o %s %s %s", _g.shellname, targetfile, objectfiles, flags) +end + +-- link the target file +function link(objectfiles, targetkind, targetfile, flags) + + -- ensure the target directory + os.mkdir(path.directory(targetfile)) + + -- link it + os.run(linkcmd(objectfiles, targetkind, targetfile, flags)) +end + -- make the compile command function _compcmd1(sourcefile, objectfile, flags) |
