summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-26 00:56:28 +0800
committerruki <[email protected]>2021-01-26 00:56:28 +0800
commit80e24282f3cb15bb5cb4a61eabea2424b1466c92 (patch)
treedcd653a054f1c7927c9af968c99ddd7b49b96fed /xmake/modules/core/tools
parent2bb2fac08d934d5611e2230948d6363a9dc581b2 (diff)
improve zigcc
Diffstat (limited to 'xmake/modules/core/tools')
-rw-r--r--xmake/modules/core/tools/zig_cc.lua24
-rw-r--r--xmake/modules/core/tools/zig_cxx.lua3
2 files changed, 25 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/zig_cc.lua b/xmake/modules/core/tools/zig_cc.lua
index 1e263a4f6..5bc0c60a9 100644
--- a/xmake/modules/core/tools/zig_cc.lua
+++ b/xmake/modules/core/tools/zig_cc.lua
@@ -21,3 +21,27 @@
-- inherit gcc
inherit("gcc")
+-- init it
+function init(self)
+
+ -- init super
+ _super.init(self)
+
+ -- init flags
+ local march
+ if is_plat("macosx") then
+ -- FIXME
+ --march = is_arch("x86") and "i386-macosx-gnu" or "x86_64-macosx-gnu"
+ elseif is_plat("linux") then
+ march = is_arch("x86") and "i386-linux-gnu" or "x86_64-linux-gnu"
+ elseif is_plat("windows") then
+ march = is_arch("x86") and "i386-windows-msvc" or "x86_64-windows-msvc"
+ elseif is_plat("mingw") then
+ march = is_arch("x86") and "i386-windows-gnu" or "x86_64-windows-gnu"
+ end
+ if march then
+ self:add("cxflags", "-target", march)
+ self:add("ldflags", "-target", march)
+ self:add("shflags", "-target", march)
+ end
+end
diff --git a/xmake/modules/core/tools/zig_cxx.lua b/xmake/modules/core/tools/zig_cxx.lua
index cb51b6d36..f9d7f9c72 100644
--- a/xmake/modules/core/tools/zig_cxx.lua
+++ b/xmake/modules/core/tools/zig_cxx.lua
@@ -18,7 +18,6 @@
-- @file zig_cxx.lua
--
--- inherit g++
-inherit("gxx")
+inherit("zig_cc")