diff options
| author | ruki <[email protected]> | 2015-06-04 15:23:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-04 15:23:45 +0800 |
| commit | 83295bd3a1b27f844759aeadbbdc23f51e2f2d89 (patch) | |
| tree | e4d371b95497d791b07af5f0224aea40dfe647dd /xmake/scripts/platform | |
| parent | 740fa0e8d4948a7261bcbb19fe7c3ac16f1df041 (diff) | |
move clang compiler and linker to tools
Diffstat (limited to 'xmake/scripts/platform')
| -rw-r--r-- | xmake/scripts/platform/macosx/macosx.lua | 22 | ||||
| -rw-r--r-- | xmake/scripts/platform/platform.lua | 63 |
2 files changed, 8 insertions, 77 deletions
diff --git a/xmake/scripts/platform/macosx/macosx.lua b/xmake/scripts/platform/macosx/macosx.lua index 4591293f0..bad818081 100644 --- a/xmake/scripts/platform/macosx/macosx.lua +++ b/xmake/scripts/platform/macosx/macosx.lua @@ -42,21 +42,15 @@ function _macosx.make(configs) configs.formats.shared = {"lib", ".dylib"} -- init the toolchains - configs.tools = {} + configs.tools = {} configs.tools.make = "make" - - -- init the compiler - configs.compiler = {} - configs.compiler.cc = config.get("cc") or "xcrun -sdk macosx clang" - configs.compiler.cxx = config.get("cxx") or "xcrun -sdk macosx clang++" - configs.compiler.mm = config.get("mm") or configs.compiler.cc - configs.compiler.mxx = config.get("mxx") or configs.compiler.cxx - - -- init the linker - configs.linker = {} - configs.linker.binary = config.get("ld") or "xcrun -sdk macosx clang++" - configs.linker.static = config.get("ar") or "xcrun -sdk macosx ar" - configs.linker.shared = config.get("sh") or "xcrun -sdk macosx clang++" + configs.tools.cc = config.get("cc") or "xcrun -sdk macosx clang" + configs.tools.cxx = config.get("cxx") or "xcrun -sdk macosx clang++" + configs.tools.mm = config.get("mm") or configs.tools.cc + configs.tools.mxx = config.get("mxx") or configs.tools.cxx + configs.tools.ld = config.get("ld") or "xcrun -sdk macosx clang++" + configs.tools.ar = config.get("ar") or "xcrun -sdk macosx ar" + configs.tools.sh = config.get("sh") or "xcrun -sdk macosx clang++" -- init xcode sdk directory configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX" .. config.get("xcode_sdkver") .. ".sdk" diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua index bd1f79485..3f9d2feec 100644 --- a/xmake/scripts/platform/platform.lua +++ b/xmake/scripts/platform/platform.lua @@ -29,8 +29,6 @@ local path = require("base/path") local utils = require("base/utils") local config = require("base/config") local global = require("base/global") -local linker = require("linker/linker") -local compiler = require("compiler/compiler") -- load prober the given platform directory function platform._load_prober(root) @@ -205,67 +203,6 @@ function platform.format(kind) end --- get the linker from the given name -function platform.linker(kind) - - -- check - assert(kind) - - -- init linkers - platform._LINKERS = platform._LINKERS or {} - local linkers = platform._LINKERS - - -- return it directly if the linker has been cached - local l = linkers[kind] - if l then return l end - - -- get linker - local c = platform.get("linker") - assert(c) - - -- load linker - c = c[kind] - if c then return linker.load(c) end - - -- cache this linker - linkers[kind] = l - - -- ok - return l -end - --- get the compiler from the given source file -function platform.compiler(srcfile) - - -- get the source file type - local filetype = compiler.filetype(srcfile) - if not filetype then - return - end - - -- init compilers - platform._COMPILERS = platform._COMPILERS or {} - local compilers = platform._COMPILERS - - -- return it directly if the compiler has been cached - local c = compilers[filetype] - if c then return c, filetype end - - -- get compiler from the current platform - c = platform.get("compiler") - assert(c) - - -- load compiler - c = c[filetype] - if c then c = compiler.load(c) end - - -- cache this compiler - compilers[filetype] = c - - -- ok - return c, filetype -end - -- dump the platform configure function platform.dump() |
