diff options
| author | star9029 <[email protected]> | 2025-02-24 14:41:50 +0800 |
|---|---|---|
| committer | star9029 <[email protected]> | 2025-02-24 14:41:50 +0800 |
| commit | dc7a9621629cf94652338fd1f15d9cab412412bb (patch) | |
| tree | 86325c8cad9f152263aaa02df513a3438ebbc844 /xmake/rules/c++/build_optimization | |
| parent | 984fb1d67fe06fe71940bf7bb8dd92b12df486e2 (diff) | |
Fix clang-cl toolchain with lto
Diffstat (limited to 'xmake/rules/c++/build_optimization')
| -rw-r--r-- | xmake/rules/c++/build_optimization/config.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xmake/rules/c++/build_optimization/config.lua b/xmake/rules/c++/build_optimization/config.lua index 357c3cf76..72b82a63a 100644 --- a/xmake/rules/c++/build_optimization/config.lua +++ b/xmake/rules/c++/build_optimization/config.lua @@ -30,6 +30,8 @@ function _add_lto_optimization(target, sourcekind) local cflag = sourcekind == "cxx" and "cxxflags" or "cflags" if cc == "cl" then target:add(cflag, "-GL") + elseif cc == "clang_cl" then + target:add(cflag, "/clang:-flto=thin") elseif cc == "clang" or cc == "clangxx" then target:add(cflag, "-flto=thin") elseif cc == "gcc" or cc == "gxx" then @@ -57,6 +59,11 @@ function _add_lto_optimization(target, sourcekind) target:add("shflags", optimize_flags) 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") + end end function main(target, sourcekind) |
