diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake index 30b10ae5980..c9f62906ae0 100644 --- a/build_files/cmake/Modules/GTestTesting.cmake +++ b/build_files/cmake/Modules/GTestTesting.cmake @@ -40,9 +40,14 @@ macro(BLENDER_SRC_GTEST_EX) add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST}) target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}") target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}") + target_link_libraries(${TARGET_NAME} ${ARG_EXTRA_LIBS} ${PLATFORM_LINKLIBS}) + if(WITH_TBB) + # Force TBB libraries to be in front of MKL (part of OpenImageDenoise), so + # that it is initialized before MKL and static library initialization order + # issues are avoided. + target_link_libraries(${TARGET_NAME} ${TBB_LIBRARIES}) + endif() target_link_libraries(${TARGET_NAME} - ${ARG_EXTRA_LIBS} - ${PLATFORM_LINKLIBS} bf_testing_main bf_intern_eigen bf_intern_guardedalloc diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 82c45b4fe64..690c332c20e 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -38,20 +38,16 @@ blender_include_dirs( ) set(LIB - # This forces TBB libraries to be in front of MKL (which is a part of OpenImageDenoise). - # - # The need of this comes to need to ensure static libraries initialization order, making it - # so TBB is initialized prior to MKL (or any other dpeendnecy). - # - # This isn't fully robust but seems to work. - ${TBB_LIBRARIES} - bf_windowmanager ) -# Note: this should not be needed, but causes issues in some situations: -# See reply to daf290dcc80c. -if(WITH_TBB AND WITH_OPENIMAGEDENOISE) +if(WITH_TBB) + # Force TBB libraries to be in front of MKL (part of OpenImageDenoise), so + # that it is initialized before MKL and static library initialization order + # issues are avoided. + # + # This isn't fully robust but seems to work. + list(INSERT LIB 0 ${TBB_LIBRARIES}) list(INSERT LIB 0 bf_blenkernel) endif()