summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-01 10:03:16 +0800
committerruki <[email protected]>2015-06-01 10:09:10 +0800
commit7381a36a64f50a6db22155ebce996351201b90cb (patch)
treefea64527b0cf27c3d00691752ceca2a678546646 /xmake/scripts/platform
parenta32ad41a1812ad88043c0ecd0a09301267de9871 (diff)
add linker and make link command
Diffstat (limited to 'xmake/scripts/platform')
-rw-r--r--xmake/scripts/platform/macosx/_macosx.lua6
-rw-r--r--xmake/scripts/platform/platform.lua35
-rw-r--r--xmake/scripts/platform/windows/_windows.lua2
3 files changed, 35 insertions, 8 deletions
diff --git a/xmake/scripts/platform/macosx/_macosx.lua b/xmake/scripts/platform/macosx/_macosx.lua
index 85b2822a1..b23204224 100644
--- a/xmake/scripts/platform/macosx/_macosx.lua
+++ b/xmake/scripts/platform/macosx/_macosx.lua
@@ -51,6 +51,12 @@ function _macosx.make(configs)
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("ld") 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"
end
diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua
index 920aeab14..57f50576c 100644
--- a/xmake/scripts/platform/platform.lua
+++ b/xmake/scripts/platform/platform.lua
@@ -28,6 +28,7 @@ local os = require("base/os")
local path = require("base/path")
local utils = require("base/utils")
local config = require("base/config")
+local linker = require("linker/linker")
local compiler = require("compiler/compiler")
-- load the given platform
@@ -86,18 +87,38 @@ function platform.get(name)
end
end
--- get the format from the given kind
-function platform.format(kind)
+-- get the filename from the given name and kind
+function platform.filename(name, kind)
-- check
- assert(kind)
+ assert(name and kind)
+
+ -- get formats
+ local formats = platform.get("format")
+ assert(formats)
-- get format
- local format = platform.get("format")
- assert(format)
+ local format = formats[kind] or {"", ""}
+
+ -- make it
+ return format[1] .. name .. format[2]
+end
+
+-- get the linker from the given name
+function platform.linker(name)
+
+ -- check
+ assert(name)
+
+ -- get linker
+ local c = platform.get("linker")
+ assert(c)
- -- get it
- return format[kind] or {"", ""}
+ -- load linker
+ c = c[name]
+ if c then
+ return linker.load(c)
+ end
end
-- get the compiler from the given name
diff --git a/xmake/scripts/platform/windows/_windows.lua b/xmake/scripts/platform/windows/_windows.lua
index 576160719..a2feb23fa 100644
--- a/xmake/scripts/platform/windows/_windows.lua
+++ b/xmake/scripts/platform/windows/_windows.lua
@@ -43,7 +43,7 @@ function _windows.make(configs)
configs.format.static = {"", ".lib"}
configs.format.object = {"", ".obj"}
configs.format.shared = {"", ".dll"}
- configs.format.console = {"", ".exe"}
+ configs.format.execute = {"", ".exe"}
end
-- get the option menu for action: xmake config or global