diff options
| author | star9029 <[email protected]> | 2025-02-27 20:22:49 +0800 |
|---|---|---|
| committer | star9029 <[email protected]> | 2025-02-27 20:22:49 +0800 |
| commit | a8c1996b0b3722fa7e1669230d09187b718774dc (patch) | |
| tree | 135322c489816e467a881f234daba3a53939064b /xmake/rules/c++/build_optimization/config.lua | |
| parent | 3513afc7545303580904a597d36a52454779699c (diff) | |
Improve clang toolcahin for building package with lto
Diffstat (limited to 'xmake/rules/c++/build_optimization/config.lua')
| -rw-r--r-- | xmake/rules/c++/build_optimization/config.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/xmake/rules/c++/build_optimization/config.lua b/xmake/rules/c++/build_optimization/config.lua index 4324bcf76..f5bff67fc 100644 --- a/xmake/rules/c++/build_optimization/config.lua +++ b/xmake/rules/c++/build_optimization/config.lua @@ -58,9 +58,17 @@ function _add_lto_optimization(target, sourcekind) end end - if cc == "clang_cl" and ld == "link" then - wprint([[clang-cl + msvc link unsupported lto, please use `set_toolset("ld", "lld-link")`]]) - target:set("toolset", "ld", "lld-link") + local program, ar = target:tool("ar") + if cc == "clang_cl" then + if ld == "link" then + wprint([[Unsupported toolset(%s) for lto, please use `set_toolset("ld", "lld-link")`]], ld) + target:set("toolset", "ld", "lld-link") + target:set("toolset", "sh", "lld-link") + end + if ar ~= "llvm-ar" and ar ~= "llvm_ar" then + wprint([[Unsupported toolset(%s) for lto, please use `set_toolset("ar", "llvm-ar")`]], ar) + target:set("toolset", "ar", "llvm-ar") + end end end |
