summaryrefslogtreecommitdiff
path: root/xmake/toolchains/gcc/xmake.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/toolchains/gcc/xmake.lua')
-rw-r--r--xmake/toolchains/gcc/xmake.lua27
1 files changed, 16 insertions, 11 deletions
diff --git a/xmake/toolchains/gcc/xmake.lua b/xmake/toolchains/gcc/xmake.lua
index 54816a98e..06be7cef9 100644
--- a/xmake/toolchains/gcc/xmake.lua
+++ b/xmake/toolchains/gcc/xmake.lua
@@ -19,7 +19,12 @@
--
-- define toolchain
-toolchain("gcc")
+function toolchain_gcc(version)
+local suffix = ""
+if version then
+ suffix = suffix .. "-" .. version
+end
+toolchain("gcc" .. suffix)
-- set homepage
set_homepage("https://gcc.gnu.org/")
@@ -29,23 +34,21 @@ toolchain("gcc")
set_kind("standalone")
-- set toolset
- set_toolset("cc", "gcc")
- set_toolset("cxx", "gcc", "g++")
- set_toolset("ld", "g++", "gcc")
- set_toolset("sh", "g++", "gcc")
+ set_toolset("cc", "gcc" .. suffix)
+ set_toolset("cxx", "gcc" .. suffix, "g++" .. suffix)
+ set_toolset("ld", "g++" .. suffix, "gcc" .. suffix)
+ set_toolset("sh", "g++" .. suffix, "gcc" .. suffix)
set_toolset("ar", "ar")
set_toolset("ex", "ar")
set_toolset("strip", "strip")
- set_toolset("mm", "gcc")
- set_toolset("mxx", "gcc", "g++")
- set_toolset("as", "gcc")
+ set_toolset("mm", "gcc" .. suffix)
+ set_toolset("mxx", "gcc" .. suffix, "g++" .. suffix)
+ set_toolset("as", "gcc" .. suffix)
- -- check toolchain
on_check(function (toolchain)
- return import("lib.detect.find_tool")("gcc")
+ return import("lib.detect.find_tool")("gcc" .. suffix)
end)
- -- on load
on_load(function (toolchain)
-- add march flags
@@ -63,3 +66,5 @@ toolchain("gcc")
toolchain:add("shflags", march)
end
end)
+end
+toolchain_gcc()