summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-20 00:43:53 +0800
committerruki <[email protected]>2020-06-19 22:23:22 +0800
commit01dd21d4f3bccda1ff18ad1213b959feeaae37eb (patch)
tree6e6d2203e3da29323d2919d32b80303e5e98d489
parentf5392149886b2083ec0d6db2adef3da405297fe8 (diff)
improve toolchain arch/plat
-rw-r--r--xmake/toolchains/clang/xmake.lua6
-rw-r--r--xmake/toolchains/dlang/xmake.lua2
-rw-r--r--xmake/toolchains/gcc/xmake.lua6
-rw-r--r--xmake/toolchains/llvm/check.lua2
-rw-r--r--xmake/toolchains/llvm/xmake.lua4
-rw-r--r--xmake/toolchains/mingw/xmake.lua6
-rw-r--r--xmake/toolchains/nasm/xmake.lua12
-rw-r--r--xmake/toolchains/ndk/load.lua2
-rw-r--r--xmake/toolchains/sdcc/xmake.lua2
-rw-r--r--xmake/toolchains/yasm/xmake.lua12
10 files changed, 27 insertions, 27 deletions
diff --git a/xmake/toolchains/clang/xmake.lua b/xmake/toolchains/clang/xmake.lua
index 1319d9899..c616a4023 100644
--- a/xmake/toolchains/clang/xmake.lua
+++ b/xmake/toolchains/clang/xmake.lua
@@ -50,9 +50,9 @@ toolchain("clang")
-- add march flags
local march
- if is_arch("x86_64", "x64") then
+ if toolchain:is_arch("x86_64", "x64") then
march = "-m64"
- elseif is_arch("i386", "x86") then
+ elseif toolchain:is_arch("i386", "x86") then
march = "-m32"
end
if march then
@@ -64,7 +64,7 @@ toolchain("clang")
end
-- add includedirs and linkdirs
- if not is_plat("windows") and os.isdir("/usr") then
+ if not toolchain:is_plat("windows") and os.isdir("/usr") then
for _, includedir in ipairs({"/usr/local/include", "/usr/include"}) do
if os.isdir(includedir) then
toolchain:add("includedirs", includedir)
diff --git a/xmake/toolchains/dlang/xmake.lua b/xmake/toolchains/dlang/xmake.lua
index 0c87d8505..e258e9af8 100644
--- a/xmake/toolchains/dlang/xmake.lua
+++ b/xmake/toolchains/dlang/xmake.lua
@@ -33,7 +33,7 @@ toolchain("dlang")
-- on load
on_load(function (toolchain)
- local march = is_arch("x86_64", "x64") and "-m64" or "-m32"
+ local march = toolchain:is_arch("x86_64", "x64") and "-m64" or "-m32"
toolchain:add("dcflags", march)
toolchain:add("dcshflags", march)
toolchain:add("dcldflags", march)
diff --git a/xmake/toolchains/gcc/xmake.lua b/xmake/toolchains/gcc/xmake.lua
index ab12fd13a..8a4a53bb5 100644
--- a/xmake/toolchains/gcc/xmake.lua
+++ b/xmake/toolchains/gcc/xmake.lua
@@ -50,9 +50,9 @@ toolchain("gcc")
-- add march flags
local march
- if is_arch("x86_64", "x64") then
+ if toolchain:is_arch("x86_64", "x64") then
march = "-m64"
- elseif is_arch("i386", "x86") then
+ elseif toolchain:is_arch("i386", "x86") then
march = "-m32"
end
if march then
@@ -64,7 +64,7 @@ toolchain("gcc")
end
-- add includedirs and linkdirs
- if not is_plat("windows") and os.isdir("/usr") then
+ if not toolchain:is_plat("windows") and os.isdir("/usr") then
for _, includedir in ipairs({"/usr/local/include", "/usr/include"}) do
if os.isdir(includedir) then
toolchain:add("includedirs", includedir)
diff --git a/xmake/toolchains/llvm/check.lua b/xmake/toolchains/llvm/check.lua
index 04d4d6dec..d590b4381 100644
--- a/xmake/toolchains/llvm/check.lua
+++ b/xmake/toolchains/llvm/check.lua
@@ -29,7 +29,7 @@ function main(toolchain)
local sdkdir = config.get("sdk")
local bindir = config.get("bin")
if not sdkdir and not bindir then
- if is_plat("linux") and os.isfile("/usr/bin/llvm-ar") then
+ if toolchain:is_plat("linux") and os.isfile("/usr/bin/llvm-ar") then
sdkdir = "/usr"
end
end
diff --git a/xmake/toolchains/llvm/xmake.lua b/xmake/toolchains/llvm/xmake.lua
index d4371682c..3912ab8d7 100644
--- a/xmake/toolchains/llvm/xmake.lua
+++ b/xmake/toolchains/llvm/xmake.lua
@@ -48,9 +48,9 @@ toolchain("llvm")
-- add march flags
local march
- if is_arch("x86_64", "x64") then
+ if toolchain:is_arch("x86_64", "x64") then
march = "-m64"
- elseif is_arch("i386", "x86") then
+ elseif toolchain:is_arch("i386", "x86") then
march = "-m32"
end
if march then
diff --git a/xmake/toolchains/mingw/xmake.lua b/xmake/toolchains/mingw/xmake.lua
index 2d246553a..e5603527f 100644
--- a/xmake/toolchains/mingw/xmake.lua
+++ b/xmake/toolchains/mingw/xmake.lua
@@ -39,9 +39,9 @@ toolchain("mingw")
-- get cross
local cross
- if is_arch("x86_64") then
+ if toolchain:is_arch("x86_64") then
cross = "x86_64-w64-mingw32-"
- elseif is_arch("i386") then
+ elseif toolchain:is_arch("i386") then
cross = "i686-w64-mingw32-"
else
cross = config.get("cross") or ""
@@ -75,7 +75,7 @@ toolchain("mingw")
-- init flags for architecture
local archflags = nil
- local arch = config.get("arch")
+ local arch = toolchain:arch()
if arch then
if arch == "x86_64" then archflags = "-m64"
elseif arch == "i386" then archflags = "-m32"
diff --git a/xmake/toolchains/nasm/xmake.lua b/xmake/toolchains/nasm/xmake.lua
index 164eaedd8..3d31a1e93 100644
--- a/xmake/toolchains/nasm/xmake.lua
+++ b/xmake/toolchains/nasm/xmake.lua
@@ -30,11 +30,11 @@ toolchain("nasm")
-- on load
on_load(function (toolchain)
- if is_plat("macosx") then
- toolchain:add("nasm.asflags", "-f", is_arch("x86_64") and "macho64" or "macho32")
- elseif is_plat("linux", "bsd") then
- toolchain:add("nasm.asflags", "-f", is_arch("x86_64") and "elf64" or "elf32")
- elseif is_plat("windows", "mingw", "msys", "cygwin") then
- toolchain:add("nasm.asflags", "-f", is_arch("x64") and "win64" or "win32")
+ if toolchain:is_plat("macosx") then
+ toolchain:add("nasm.asflags", "-f", toolchain:is_arch("x86_64") and "macho64" or "macho32")
+ elseif toolchain:is_plat("linux", "bsd") then
+ toolchain:add("nasm.asflags", "-f", toolchain:is_arch("x86_64") and "elf64" or "elf32")
+ elseif toolchain:is_plat("windows", "mingw", "msys", "cygwin") then
+ toolchain:add("nasm.asflags", "-f", toolchain:is_arch("x64") and "win64" or "win32")
end
end)
diff --git a/xmake/toolchains/ndk/load.lua b/xmake/toolchains/ndk/load.lua
index 153a93f9b..cbc2ab4a2 100644
--- a/xmake/toolchains/ndk/load.lua
+++ b/xmake/toolchains/ndk/load.lua
@@ -48,7 +48,7 @@ function main(toolchain)
-- init flags
local arm32 = false
- local arch = config.get("arch")
+ local arch = toolchain:arch()
toolchain:add("ldflags", "-llog")
toolchain:add("shflags", "-llog")
if arch and (arch == "armeabi" or arch == "armeabi-v7a" or arch == "armv5te" or arch == "armv7-a") then -- armv5te/armv7-a are deprecated
diff --git a/xmake/toolchains/sdcc/xmake.lua b/xmake/toolchains/sdcc/xmake.lua
index ce4862822..c76723c2a 100644
--- a/xmake/toolchains/sdcc/xmake.lua
+++ b/xmake/toolchains/sdcc/xmake.lua
@@ -67,7 +67,7 @@ toolchain("sdcc")
end
-- add port flags for arch
- local arch = get_config("arch")
+ local arch = toolchain:arch()
if arch then
toolchain:add("cxflags", "-m" .. arch)
toolchain:add("ldflags", "-m" .. arch)
diff --git a/xmake/toolchains/yasm/xmake.lua b/xmake/toolchains/yasm/xmake.lua
index 7811219b5..b28fe7cc0 100644
--- a/xmake/toolchains/yasm/xmake.lua
+++ b/xmake/toolchains/yasm/xmake.lua
@@ -30,11 +30,11 @@ toolchain("yasm")
-- on load
on_load(function (toolchain)
- if is_plat("macosx") then
- toolchain:add("yasm.asflags", "-f", is_arch("x86_64") and "macho64" or "macho32")
- elseif is_plat("linux", "bsd") then
- toolchain:add("yasm.asflags", "-f", is_arch("x86_64") and "elf64" or "elf32")
- elseif is_plat("windows", "mingw", "msys", "cygwin") then
- toolchain:add("yasm.asflags", "-f", is_arch("x86_64", "x64") and "win64" or "win32")
+ if toolchain:is_plat("macosx") then
+ toolchain:add("yasm.asflags", "-f", toolchain:is_arch("x86_64") and "macho64" or "macho32")
+ elseif toolchain:is_plat("linux", "bsd") then
+ toolchain:add("yasm.asflags", "-f", toolchain:is_arch("x86_64") and "elf64" or "elf32")
+ elseif toolchain:is_plat("windows", "mingw", "msys", "cygwin") then
+ toolchain:add("yasm.asflags", "-f", toolchain:is_arch("x86_64", "x64") and "win64" or "win32")
end
end)