From 910d07ba13e3facac90859dc4598a1d0871037e1 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 30 Apr 2021 00:33:31 +0800 Subject: improve find llvm --- xmake/toolchains/llvm/check.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1