summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstar9029 <[email protected]>2024-11-18 19:45:19 +0800
committerstar9029 <[email protected]>2024-11-18 19:45:19 +0800
commit38581f8517c86a814a432b3c2bf2517c11910dec (patch)
treef5454817a3560f0d683645d5be5ce1f346b353ac
parent6b313466efa9636ca392ae39b2ba03592e6a4678 (diff)
fix clang
-rw-r--r--xmake/toolchains/clang/check.lua8
-rw-r--r--xmake/toolchains/clang/load.lua4
-rw-r--r--xmake/toolchains/clang/xmake.lua4
3 files changed, 9 insertions, 7 deletions
diff --git a/xmake/toolchains/clang/check.lua b/xmake/toolchains/clang/check.lua
index 6b242f469..7c23a4f1c 100644
--- a/xmake/toolchains/clang/check.lua
+++ b/xmake/toolchains/clang/check.lua
@@ -22,7 +22,7 @@ import("detect.sdks.find_vstudio")
import("lib.detect.find_tool")
import("core.project.config")
-function _check_vc_build_tools(toolchain, sdkdir)
+function _check_vc_build_tools(toolchain, sdkdir, suffix)
local opt = {}
opt.sdkdir = sdkdir
opt.vs_toolset = toolchain:config("vs_toolset") or config.get("vs_toolset")
@@ -47,7 +47,7 @@ function _check_vc_build_tools(toolchain, sdkdir)
if pathenv then
paths = path.splitenv(pathenv)
end
- local clang = find_tool("clang", {version = true, force = true, paths = paths, envs = vcvars})
+ local clang = find_tool("clang" .. suffix, {version = true, force = true, paths = paths, envs = vcvars})
if clang and clang.version then
cprint("checking for LLVM Clang C/C++ Compiler (%s) version ... ${color.success}%s", toolchain:arch(), clang.version)
end
@@ -55,7 +55,7 @@ function _check_vc_build_tools(toolchain, sdkdir)
end
end
-function main(toolchain)
+function main(toolchain, suffix)
-- only for windows or linux (msvc-wine)
if not is_host("windows", "linux") then
@@ -64,6 +64,6 @@ function main(toolchain)
local sdkdir = toolchain:sdkdir()
if sdkdir then
- return _check_vc_build_tools(toolchain, sdkdir)
+ return _check_vc_build_tools(toolchain, sdkdir, suffix)
end
end
diff --git a/xmake/toolchains/clang/load.lua b/xmake/toolchains/clang/load.lua
index 83ce677a6..0df22a398 100644
--- a/xmake/toolchains/clang/load.lua
+++ b/xmake/toolchains/clang/load.lua
@@ -46,7 +46,7 @@ function _add_vsenv(toolchain, name, curenvs)
end
end
-function main(toolchain)
+function main(toolchain, suffix)
local target
if toolchain:is_arch("x86_64", "x64") then
target = "x86_64"
@@ -85,6 +85,8 @@ function main(toolchain)
toolchain:add("linkdirs", dir)
end
end
+ toolchain:add("ldflags", "-fuse-ld=lld-link" .. suffix)
+ toolchain:add("shflags", "-fuse-ld=lld-link" .. suffix)
end
elseif toolchain:is_plat("mingw") then
target = target .. "-windows-gnu"
diff --git a/xmake/toolchains/clang/xmake.lua b/xmake/toolchains/clang/xmake.lua
index 6add600ef..cf3b2e3f6 100644
--- a/xmake/toolchains/clang/xmake.lua
+++ b/xmake/toolchains/clang/xmake.lua
@@ -45,7 +45,7 @@ toolchain("clang" .. suffix)
on_check(function (toolchain)
if toolchain:is_plat("windows") then
- local result = import("check")(toolchain)
+ local result = import("check")(toolchain, suffix)
if result then
return result
end
@@ -72,7 +72,7 @@ toolchain("clang" .. suffix)
toolchain:add("runtimes", "MT", "MTd", "MD", "MDd")
end
if toolchain:is_plat("windows", "mingw") then
- import("load")(toolchain)
+ import("load")(toolchain, suffix)
end
end)
end