diff options
| author | ruki <[email protected]> | 2021-04-30 00:33:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-04-30 00:33:31 +0800 |
| commit | 910d07ba13e3facac90859dc4598a1d0871037e1 (patch) | |
| tree | b55e077732c6dd207568d4d7ce76ae29e5fce4c9 | |
| parent | 495ca8241a0bf6e8b8972ddfe637bf4fce7a58f2 (diff) | |
improve find llvm
| -rw-r--r-- | xmake/toolchains/llvm/check.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/xmake/toolchains/llvm/check.lua b/xmake/toolchains/llvm/check.lua index 690a6ea30..f63418cc8 100644 --- a/xmake/toolchains/llvm/check.lua +++ b/xmake/toolchains/llvm/check.lua @@ -20,6 +20,7 @@ -- imports import("core.project.config") +import("lib.detect.find_path") import("detect.sdks.find_xcode") import("detect.sdks.find_cross_toolchain") @@ -57,8 +58,13 @@ function main(toolchain) local sdkdir = toolchain:sdkdir() local bindir = toolchain:bindir() if not sdkdir and not bindir then - if toolchain:is_plat("linux") and os.isfile("/usr/bin/llvm-ar") then + if is_host("linux") and os.isfile("/usr/bin/llvm-ar") then sdkdir = "/usr" + elseif is_host("macosx") then + local bindir = find_path("llvm-ar", "/usr/local/Cellar/llvm/*/bin") + if bindir then + sdkdir = path.directory(bindir) + end end end |
