summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-06 00:41:47 +0800
committerruki <[email protected]>2021-01-06 00:41:47 +0800
commit245e65345a788c2c5c888551654fbf2f1feb0814 (patch)
tree9ed5d8ed056e8cac673dfbd0757a38b85e988fdc
parentbc9843056d93f1ccc6717763f1bbd98f6f23e6c7 (diff)
improve llvm toolchain
-rw-r--r--CHANGELOG.md2
-rw-r--r--xmake/toolchains/llvm/xmake.lua10
2 files changed, 11 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb75ea518..e39d52aa1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
* [#1071](https://github.com/xmake-io/xmake/issues/1071): Improve to generate vs/vsxmake project to support for remote packages
* Improve vs/vsxmake project plugin to support global `set_arch()` setting
* [#1164](https://github.com/xmake-io/xmake/issues/1164): Improve to launch console programs for vsxmake project
+* [#1179](https://github.com/xmake-io/xmake/issues/1179): Improve llvm toolchain and add isysroot
### Bugs fixed
@@ -912,6 +913,7 @@
* [#1071](https://github.com/xmake-io/xmake/issues/1071): 改进 vs/vsxmake 生成插件去支持远程依赖包
* 改进 vs/vsxmake 工程生成插件去支持全局的 `set_arch()` 设置
* [#1164](https://github.com/xmake-io/xmake/issues/1164): 改进 vsxmake 插件调试加载 console 程序
+* [#1179](https://github.com/xmake-io/xmake/issues/1179): 改进 llvm 工具链,添加 isysroot
### Bugs 修复
diff --git a/xmake/toolchains/llvm/xmake.lua b/xmake/toolchains/llvm/xmake.lua
index 6b6598406..86ab4a13d 100644
--- a/xmake/toolchains/llvm/xmake.lua
+++ b/xmake/toolchains/llvm/xmake.lua
@@ -61,7 +61,7 @@ toolchain("llvm")
toolchain:add("shflags", march)
end
- -- init flags for the xcode sdk directory
+ -- init flags for macOS
if toolchain:is_plat("macosx") then
local xcode_dir = get_config("xcode")
local xcode_sdkver = toolchain:config("xcode_sdkver")
@@ -71,6 +71,14 @@ toolchain("llvm")
toolchain:add("cxflags", "-isysroot " .. xcode_sdkdir)
toolchain:add("ldflags", "-isysroot " .. xcode_sdkdir)
toolchain:add("shflags", "-isysroot " .. xcode_sdkdir)
+ else
+ -- @see https://github.com/xmake-io/xmake/issues/1179
+ local macsdk = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
+ if os.exists(macsdk) then
+ toolchain:add("cxflags", "-isysroot " .. macsdk)
+ toolchain:add("ldflags", "-isysroot " .. macsdk)
+ toolchain:add("shflags", "-isysroot " .. macsdk)
+ end
end
end