Files
OrcaSlicer/deps/TBB/TBB.cmake
Gabriel 0a7ac3f2ac 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.
2026-06-24 00:36:59 -03:00

29 lines
902 B
CMake

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 "")
endif()
orcaslicer_add_cmake_project(
TBB
URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.5.0.zip"
URL_HASH SHA256=83ea786c964a384dd72534f9854b419716f412f9d43c0be88d41874763e7bb47
PATCH_COMMAND ${_patch_command}
CMAKE_ARGS
-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
)
if (MSVC)
add_debug_dep(dep_TBB)
endif ()