diff options
| author | Doekin <[email protected]> | 2025-03-24 19:13:58 +0800 |
|---|---|---|
| committer | Doekin <[email protected]> | 2025-03-24 19:13:58 +0800 |
| commit | ca5bee871aba1afba67cb8940ca753c2611114f5 (patch) | |
| tree | 575cc23471d4d004bd089ffdd9d3368c7e3ec71d /xmake/toolchains/llvm/check.lua | |
| parent | 24ca1cece1c6fec273a65a2dff5aca8a8efef9b5 (diff) | |
toolchain(llvm): locate appropriate toolchain when `cross` is specified
Diffstat (limited to 'xmake/toolchains/llvm/check.lua')
| -rw-r--r-- | xmake/toolchains/llvm/check.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/toolchains/llvm/check.lua b/xmake/toolchains/llvm/check.lua index 54ec397a5..a398d26df 100644 --- a/xmake/toolchains/llvm/check.lua +++ b/xmake/toolchains/llvm/check.lua @@ -58,6 +58,7 @@ function main(toolchain) -- get sdk directory local sdkdir = toolchain:sdkdir() local bindir = toolchain:bindir() + local cross = toolchain:cross() if not sdkdir and not bindir then bindir = try {function () return os.iorunv("llvm-config", {"--bindir"}) end} if bindir then @@ -83,7 +84,7 @@ function main(toolchain) end -- find cross toolchain from external envirnoment - local cross_toolchain = find_cross_toolchain(sdkdir, {bindir = bindir}) + local cross_toolchain = find_cross_toolchain(sdkdir, {bindir = bindir, cross = cross}) if not cross_toolchain then -- find it from packages for _, package in ipairs(toolchain:packages()) do @@ -105,6 +106,10 @@ function main(toolchain) raise("llvm toolchain not found!") end + if toolchain:is_plat("cross") and (not toolchain:cross() or toolchain:cross():match("^%s*$")) then + raise("Missing cross target. Use `--cross=name` to specify.") + end + -- attempt to find xcode to pass `-isysroot` on macos if toolchain:is_plat("macosx") then _find_xcode(toolchain) |
