improve to find llvm

pull/1795/head
ruki 2 years ago
parent 5e99992b32
commit b310d3c8bb
  1. 13
      packages/l/llvm/xmake.lua

@ -71,7 +71,18 @@ package("llvm")
on_fetch(function (package, opt) on_fetch(function (package, opt)
if opt.system then if opt.system then
local version = try {function() return os.iorunv("llvm-config --version") end} local llvm_config = "llvm-config"
if is_host("macosx") then
import("lib.detect.find_tool")
local llvm = try {function () return os.iorunv("brew", {"--prefix", "llvm"}) end}
if llvm then
local ret = find_tool("llvm-config", {paths = path.join(llvm:trim(), "bin")})
if ret then
llvm_config = ret.program
end
end
end
local version = try {function() return os.iorunv(llvm_config, {"--version"}) end}
if version then if version then
return {version = version:trim()} return {version = version:trim()}
end end

Loading…
Cancel
Save