fix: disable TBB LTCG to allow linking with lld-link

oneTBB enables MSVC IPO/LTCG by default, which emits MSVC proprietary bitcode
objects when built with cl.exe.

lld-link cannot consume those /GL objects. Patch the TBB MSVC compiler settings
so IPO can be disabled and the dependency produces native COFF objects that both
link.exe and lld-link can consume.
This commit is contained in:
Gabriel
2026-06-24 00:36:59 -03:00
parent d865e9e6e1
commit 0a7ac3f2ac
2 changed files with 103 additions and 1 deletions

6
deps/TBB/TBB.cmake vendored
View File

@@ -1,4 +1,6 @@
if (FLATPAK AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (MSVC)
set(_patch_command ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/MSVC.cmake ./cmake/compilers/MSVC.cmake)
elseif (FLATPAK AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(_patch_command ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/GNU.cmake ./cmake/compilers/GNU.cmake)
else()
set(_patch_command "")
@@ -13,6 +15,8 @@ orcaslicer_add_cmake_project(
-DTBB_BUILD_SHARED=OFF
-DTBB_BUILD_TESTS=OFF
-DTBB_TEST=OFF
-DTBB_ENABLE_IPO=OFF
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_DEBUG_POSTFIX=_debug
)