From a85e4aa3048cc909b5e70ece7bc61c7d59f57c9d Mon Sep 17 00:00:00 2001 From: Maxwell Geng <33229754+MaxwellGengYF@users.noreply.github.com> Date: Mon, 6 May 2024 09:47:46 +0800 Subject: Support windows find LLVM toolchain --- xmake/toolchains/llvm/check.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xmake/toolchains/llvm/check.lua b/xmake/toolchains/llvm/check.lua index c33dc187e..9bbebac84 100644 --- a/xmake/toolchains/llvm/check.lua +++ b/xmake/toolchains/llvm/check.lua @@ -73,6 +73,20 @@ function main(toolchain) if bindir then sdkdir = path.directory(bindir) end + elseif is_host("windows") then + bindir = try {function () return path.directory(os.iorunv("where", {"llvm-ar.exe"})) end} + if not bindir then + local paths = os.getenv("PATH"):split(';') + for i, v in ipairs(paths) do + if os.isfile(path.join(v, "llvm-ar.exe")) then + bindir = v + break + end + end + end + if bindir then + sdkdir = path.directory(bindir) + end end end -- cgit v1.3.1 From 55716912ce7b5b8c9a45994e4bc7b0814b03ef61 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 6 May 2024 17:07:43 +0800 Subject: Update check.lua --- xmake/toolchains/llvm/check.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xmake/toolchains/llvm/check.lua b/xmake/toolchains/llvm/check.lua index 9bbebac84..cee19baac 100644 --- a/xmake/toolchains/llvm/check.lua +++ b/xmake/toolchains/llvm/check.lua @@ -76,11 +76,13 @@ function main(toolchain) elseif is_host("windows") then bindir = try {function () return path.directory(os.iorunv("where", {"llvm-ar.exe"})) end} if not bindir then - local paths = os.getenv("PATH"):split(';') - for i, v in ipairs(paths) do - if os.isfile(path.join(v, "llvm-ar.exe")) then - bindir = v - break + local pathenv = os.getenv("PATH") + if pathenv then + for _, v in ipairs(path.splitenv(pathenv)) do + if os.isfile(path.join(v, "llvm-ar.exe")) then + bindir = v + break + end end end end -- cgit v1.3.1