From 3ccf27073cb31c6d19be436c634ec1da9a460796 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 23 May 2024 00:27:18 +0800 Subject: [PATCH 1/3] fix find llvm-ar --- xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 2 +- xmake/toolchains/llvm/check.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index 3923916d902..aae3c2e4fbb 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -86,7 +86,7 @@ function sandbox_lib_detect_find_program._check(program, opt) findname = program end if sandbox_lib_detect_find_program._do_check(findname, opt) then - return program + return findname -- check "zig c++" without ".exe" -- https://github.com/xmake-io/xmake/issues/2232 elseif findname ~= program and path.filename(program):find(" ", 1, true) and diff --git a/xmake/toolchains/llvm/check.lua b/xmake/toolchains/llvm/check.lua index 6fe57b2aaba..1a61962fccc 100644 --- a/xmake/toolchains/llvm/check.lua +++ b/xmake/toolchains/llvm/check.lua @@ -74,7 +74,7 @@ function main(toolchain) sdkdir = path.directory(bindir) end elseif is_host("windows") then - local llvm_ar = find_tool("llvm-ar", {force = true, envs = {PATH = os.getenvs("PATH")}}) + local llvm_ar = find_tool("llvm-ar", {force = true, envs = {PATH = os.getenv("PATH")}}) if llvm_ar and llvm_ar.program and os.isfile(llvm_ar.program) then bindir = path.directory(llvm_ar.program) sdkdir = path.directory(bindir) From bb7fa2ba468eb0f0b04266b597bfc562dcaa804e Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 23 May 2024 00:27:31 +0800 Subject: [PATCH 2/3] improve to check llvm --- xmake/toolchains/llvm/check.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/toolchains/llvm/check.lua b/xmake/toolchains/llvm/check.lua index 1a61962fccc..54ec397a5a7 100644 --- a/xmake/toolchains/llvm/check.lua +++ b/xmake/toolchains/llvm/check.lua @@ -75,7 +75,7 @@ function main(toolchain) end elseif is_host("windows") then local llvm_ar = find_tool("llvm-ar", {force = true, envs = {PATH = os.getenv("PATH")}}) - if llvm_ar and llvm_ar.program and os.isfile(llvm_ar.program) then + if llvm_ar and llvm_ar.program and path.is_absolute(llvm_ar.program) then bindir = path.directory(llvm_ar.program) sdkdir = path.directory(bindir) end From 5779f5f90b169569e41db19633b634c7d509901c Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 23 May 2024 00:27:40 +0800 Subject: [PATCH 3/3] revert to find_program --- xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index aae3c2e4fbb..3923916d902 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -86,7 +86,7 @@ function sandbox_lib_detect_find_program._check(program, opt) findname = program end if sandbox_lib_detect_find_program._do_check(findname, opt) then - return findname + return program -- check "zig c++" without ".exe" -- https://github.com/xmake-io/xmake/issues/2232 elseif findname ~= program and path.filename(program):find(" ", 1, true) and