diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e96d15aaa0..ea5b786a688 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1679,6 +1679,10 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING)) endif() endif() +# ----------------------------------------------------------------------------- +# Common dependency targets + +include(dependency_targets) # ----------------------------------------------------------------------------- # Ninja Job Limiting diff --git a/build_files/cmake/platform/dependency_targets.cmake b/build_files/cmake/platform/dependency_targets.cmake new file mode 100644 index 00000000000..d8623be7972 --- /dev/null +++ b/build_files/cmake/platform/dependency_targets.cmake @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: 2024 Blender Authors +# +# SPDX-License-Identifier: GPL-2.0-or-later + +# Common modern targets for the blender dependencies +# +# The optional dependencies in the bf::dependencies::optional namespace +# will always exist, but will only be populated if the dep is actually +# enabled. Doing it this way, prevents us from having to sprinkle +# if(WITH_SOMEDEP) all over cmake, and you can just add +# `bf::dependencies::optional::somedep` to the LIB section without +# having to worry if it's enabled or not at the consumer site. + +# ----------------------------------------------------------------------------- +# Configure TBB + +add_library(bf_deps_optional_tbb INTERFACE) +add_library(bf::dependencies::optional::tbb ALIAS bf_deps_optional_tbb) + +if(WITH_TBB) + target_compile_definitions(bf_deps_optional_tbb INTERFACE WITH_TBB) + target_include_directories(bf_deps_optional_tbb SYSTEM INTERFACE ${TBB_INCLUDE_DIRS}) + target_link_libraries(bf_deps_optional_tbb INTERFACE ${TBB_LIBRARIES}) +endif() diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt index c3a8c302c4b..311d8b8ab60 100644 --- a/extern/mantaflow/CMakeLists.txt +++ b/extern/mantaflow/CMakeLists.txt @@ -86,15 +86,6 @@ if(WITH_MANTA_NUMPY AND WITH_PYTHON_NUMPY) ) endif() -if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - if(WITH_OPENVDB) list(APPEND INC_SYS ${OPENVDB_INCLUDE_DIRS} @@ -245,6 +236,7 @@ if(WITH_MANTA_NUMPY AND WITH_PYTHON_NUMPY) endif() set(LIB + PRIVATE bf::dependencies::optional::tbb ${PYTHON_LINKFLAGS} ${PYTHON_LIBRARIES} ) diff --git a/intern/mantaflow/CMakeLists.txt b/intern/mantaflow/CMakeLists.txt index c9c1bf220f0..646938e9ef7 100644 --- a/intern/mantaflow/CMakeLists.txt +++ b/intern/mantaflow/CMakeLists.txt @@ -38,15 +38,6 @@ set(INC_SYS ${ZLIB_INCLUDE_DIRS} ) -if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - if(WITH_OPENVDB) add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS}) list(APPEND INC_SYS @@ -74,6 +65,7 @@ set(LIB PRIVATE bf::blenlib PRIVATE bf::dna PRIVATE bf::intern::guardedalloc + PRIVATE bf::dependencies::optional::tbb extern_mantaflow ${PYTHON_LINKFLAGS} diff --git a/intern/mikktspace/CMakeLists.txt b/intern/mikktspace/CMakeLists.txt index 8ea60927646..f7ea60b61a2 100644 --- a/intern/mikktspace/CMakeLists.txt +++ b/intern/mikktspace/CMakeLists.txt @@ -5,11 +5,7 @@ add_library(bf_intern_mikktspace INTERFACE) target_include_directories(bf_intern_mikktspace INTERFACE .) -if(WITH_TBB) - target_compile_definitions(bf_intern_mikktspace INTERFACE -DWITH_TBB) - target_include_directories(bf_intern_mikktspace INTERFACE ${TBB_INCLUDE_DIRS}) - target_link_libraries(bf_intern_mikktspace INTERFACE ${TBB_LIBRARIES}) -endif() +target_link_libraries(bf_intern_mikktspace INTERFACE bf::dependencies::optional::tbb) # CMake 3.19+ allows one to populate the interface library with # source files to show in the IDE. diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index f24e4a20cdf..714392132da 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -806,18 +806,6 @@ if(WITH_XR_OPENXR) add_definitions(-DWITH_XR_OPENXR) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - if(WITH_EXPERIMENTAL_FEATURES) add_definitions(-DWITH_ANIM_BAKLAVA) endif() diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 76605bd9602..d29da418b56 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -412,6 +412,7 @@ set(LIB extern_wcwidth PRIVATE bf::intern::atomic PRIVATE extern_fmtlib + PUBLIC bf::dependencies::optional::tbb ${ZLIB_LIBRARIES} ${ZSTD_LIBRARIES} ) @@ -428,18 +429,6 @@ if(WITH_MEM_VALGRIND) add_definitions(-DWITH_MEM_VALGRIND) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - if(WITH_GMP) add_definitions(-DWITH_GMP) diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 4203c21297b..edf3ad83969 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -83,13 +83,6 @@ if(WITH_ALEMBIC) add_definitions(-DWITH_ALEMBIC) endif() -if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - add_definitions(-DWITH_TBB) -endif() - if(WIN32) add_definitions(-DNOMINMAX) endif() diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index af8741ce413..fefaba3b890 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -202,19 +202,11 @@ if(WITH_GMP) endif() if(WITH_TBB) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. add_definitions(-DNOMINMAX) endif() - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) endif() blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 04bcde6a85f..5b9ba5d8036 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -576,10 +576,6 @@ if(WITH_COMPOSITOR_CPU) ) if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt b/source/blender/compositor/realtime_compositor/CMakeLists.txt index 4b55062bcd3..3a095126773 100644 --- a/source/blender/compositor/realtime_compositor/CMakeLists.txt +++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt @@ -369,10 +369,6 @@ set(shader_create_info_list_file "${CMAKE_CURRENT_BINARY_DIR}/compositor_shader_ file(GENERATE OUTPUT ${shader_create_info_list_file} CONTENT "${SHADER_CREATE_INFOS_CONTENT}") if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index 5cd755a1fb9..a3cff95122e 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -168,18 +168,6 @@ if(WITH_PYTHON) ) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - if(WITH_EXPERIMENTAL_FEATURES) add_definitions(-DWITH_ANIM_BAKLAVA) endif() diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 925ec567c3f..70faf8f7a55 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -844,21 +844,11 @@ if(WITH_GTESTS) endif() if(WITH_TBB) - add_definitions(-DWITH_TBB) - if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. add_definitions(-DNOMINMAX) endif() - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) endif() blender_add_lib(bf_draw "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt index dc64af326a2..a67eba66134 100644 --- a/source/blender/editors/curve/CMakeLists.txt +++ b/source/blender/editors/curve/CMakeLists.txt @@ -41,18 +41,6 @@ set(LIB PRIVATE bf::intern::guardedalloc ) -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_editor_curve "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # RNA_prototypes.hh diff --git a/source/blender/editors/curves/CMakeLists.txt b/source/blender/editors/curves/CMakeLists.txt index 9ddac358cf3..4f942712d51 100644 --- a/source/blender/editors/curves/CMakeLists.txt +++ b/source/blender/editors/curves/CMakeLists.txt @@ -44,10 +44,6 @@ set(LIB ) if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. diff --git a/source/blender/editors/grease_pencil/CMakeLists.txt b/source/blender/editors/grease_pencil/CMakeLists.txt index 28572750100..437c2c109f5 100644 --- a/source/blender/editors/grease_pencil/CMakeLists.txt +++ b/source/blender/editors/grease_pencil/CMakeLists.txt @@ -50,17 +50,5 @@ set(LIB extern_fmtlib ) -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_editor_grease_pencil "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") add_dependencies(bf_editor_curves bf_rna) diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index e9fa7d85a05..ccce3c7fcf5 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -85,18 +85,6 @@ if(WITH_GMP) add_definitions(-DWITH_GMP) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # RNA_prototypes.hh diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index 4e8bdc17d19..942e35e7cc4 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -60,10 +60,6 @@ if(WITH_FREESTYLE) endif() if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 4b669c74024..3d338a2764b 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -166,13 +166,6 @@ set(LIB PRIVATE bf::intern::guardedalloc ) -if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - add_definitions(-DWITH_TBB) -endif() - if(WIN32) add_definitions(-DNOMINMAX) endif() diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt index b958b3b4357..128f5794a14 100644 --- a/source/blender/editors/space_clip/CMakeLists.txt +++ b/source/blender/editors/space_clip/CMakeLists.txt @@ -53,18 +53,6 @@ set(LIB PRIVATE bf::intern::guardedalloc ) -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_editor_space_clip "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # RNA_prototypes.hh diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index f38ccbd8811..e6908db4d5d 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -62,17 +62,6 @@ if(WITH_IMAGE_WEBP) add_definitions(-DWITH_WEBP) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index ecf62127f7d..0b1a4db3241 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -90,19 +90,11 @@ if(WITH_OPENVDB) endif() if(WITH_TBB) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. add_definitions(-DNOMINMAX) endif() - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) endif() blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index b39b0de6c48..42924fb4049 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -76,16 +76,6 @@ if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index 56b5daacb6b..fc3f8a0ab7b 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -106,18 +106,6 @@ if(WITH_XR_OPENXR) add_definitions(-DWITH_XR_OPENXR) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # RNA_prototypes.hh diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index 1433c5656e1..6dcad6e3ce8 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -128,18 +128,6 @@ set(LIB PRIVATE bf::intern::guardedalloc ) -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # RNA_prototypes.hh diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt index b278da22e16..d472be6b232 100644 --- a/source/blender/functions/CMakeLists.txt +++ b/source/blender/functions/CMakeLists.txt @@ -48,19 +48,11 @@ set(LIB ) if(WITH_TBB) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. add_definitions(-DNOMINMAX) endif() - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) endif() blender_add_lib(bf_functions "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/geometry/CMakeLists.txt b/source/blender/geometry/CMakeLists.txt index c3ca7d73aa9..28aca44ee37 100644 --- a/source/blender/geometry/CMakeLists.txt +++ b/source/blender/geometry/CMakeLists.txt @@ -114,18 +114,6 @@ if(WITH_OPENVDB) add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS}) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - if(WITH_GMP) add_definitions(-DWITH_GMP) diff --git a/source/blender/gpencil_modifiers_legacy/CMakeLists.txt b/source/blender/gpencil_modifiers_legacy/CMakeLists.txt index 98f6c509e3c..62a67e4738e 100644 --- a/source/blender/gpencil_modifiers_legacy/CMakeLists.txt +++ b/source/blender/gpencil_modifiers_legacy/CMakeLists.txt @@ -72,19 +72,11 @@ set(SRC ) if(WITH_TBB) -add_definitions(-DWITH_TBB) -if(WIN32) - # TBB includes Windows.h which will define min/max macros - # that will collide with the stl versions. - add_definitions(-DNOMINMAX) -endif() -list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} -) - -list(APPEND LIB - ${TBB_LIBRARIES} -) + if(WIN32) + # TBB includes Windows.h which will define min/max macros + # that will collide with the stl versions. + add_definitions(-DNOMINMAX) + endif() endif() set(LIB diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index dbe9cad5c18..2aae9630253 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -837,18 +837,6 @@ if(WITH_OPENCOLORIO) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_gpu "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") target_link_libraries(bf_gpu PUBLIC bf_compositor_shaders diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index c02870489f3..62fb77581d1 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -161,18 +161,6 @@ if(WITH_IMAGE_WEBP) add_definitions(-DWITH_WEBP) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - list(APPEND INC ../../../intern/opencolorio ) diff --git a/source/blender/io/alembic/CMakeLists.txt b/source/blender/io/alembic/CMakeLists.txt index ff7d681c25e..b229f6a61a4 100644 --- a/source/blender/io/alembic/CMakeLists.txt +++ b/source/blender/io/alembic/CMakeLists.txt @@ -102,18 +102,6 @@ if(WITH_BOOST) ) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib(bf_io_alembic "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") if(WITH_GTESTS) diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt index 99420972e92..691b0986411 100644 --- a/source/blender/io/usd/CMakeLists.txt +++ b/source/blender/io/usd/CMakeLists.txt @@ -27,7 +27,6 @@ endif() # USD headers use deprecated TBB headers, silence warning. add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1) -add_definitions(-DWITH_TBB) # Check if USD has the imaging headers available, if they are # add a USD_HAS_IMAGING define so code can dynamically detect this. diff --git a/source/blender/io/wavefront_obj/CMakeLists.txt b/source/blender/io/wavefront_obj/CMakeLists.txt index ba82f3d5441..6614e8c9efe 100644 --- a/source/blender/io/wavefront_obj/CMakeLists.txt +++ b/source/blender/io/wavefront_obj/CMakeLists.txt @@ -62,12 +62,6 @@ set(LIB PRIVATE bf::extern::fmtlib ) -if(WITH_TBB) - add_definitions(-DWITH_TBB) - list(APPEND INC_SYS ${TBB_INCLUDE_DIRS}) - list(APPEND LIB ${TBB_LIBRARIES}) -endif() - blender_add_lib(bf_io_wavefront_obj "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") if(WITH_GTESTS) diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 8481dddf4a9..4259f998eea 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -18,6 +18,7 @@ set(INC_SYS set(LIB PRIVATE bf::intern::atomic PRIVATE bf::intern::guardedalloc + PRIVATE bf::dependencies::optional::tbb ) add_definitions(-DWITH_DNA_GHASH) @@ -159,6 +160,7 @@ set(SRC set(LIB PRIVATE bf::intern::atomic PRIVATE bf::intern::guardedalloc + PRIVATE bf::dependencies::optional::tbb ) blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 93a3c440f76..844a436a85b 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -451,6 +451,7 @@ target_link_libraries(makesrna PRIVATE bf_dna) target_link_libraries(makesrna PRIVATE bf::intern::atomic) target_link_libraries(makesrna PRIVATE bf::intern::guardedalloc) target_link_libraries(makesrna PRIVATE bf_dna_blenlib) +target_link_libraries(makesrna PRIVATE bf::dependencies::optional::tbb) if(WIN32 AND NOT UNIX) if(DEFINED PTHREADS_LIBRARIES) @@ -484,6 +485,7 @@ set(SRC set(LIB PRIVATE bf::animrig PRIVATE bf::dna + PRIVATE bf::dependencies::optional::tbb PRIVATE extern_fmtlib bf_editor_space_api diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 2c2b1b5aa12..aa3fffdc985 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -214,19 +214,11 @@ if(WITH_GMP) endif() if(WITH_TBB) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. add_definitions(-DNOMINMAX) endif() - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) endif() if(WITH_OPENVDB) diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 31ebf363dfb..36a4f93a674 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -160,10 +160,6 @@ if(WITH_BULLET) endif() if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. diff --git a/source/blender/nodes/geometry/CMakeLists.txt b/source/blender/nodes/geometry/CMakeLists.txt index e13ba1376c2..5d3b554215d 100644 --- a/source/blender/nodes/geometry/CMakeLists.txt +++ b/source/blender/nodes/geometry/CMakeLists.txt @@ -276,10 +276,6 @@ if(WITH_BULLET) endif() if(WITH_TBB) - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. diff --git a/source/blender/nodes/shader/CMakeLists.txt b/source/blender/nodes/shader/CMakeLists.txt index b1715b2c35c..493e43c4790 100644 --- a/source/blender/nodes/shader/CMakeLists.txt +++ b/source/blender/nodes/shader/CMakeLists.txt @@ -170,19 +170,11 @@ if(WITH_FREESTYLE) endif() if(WITH_TBB) - add_definitions(-DWITH_TBB) if(WIN32) # TBB includes Windows.h which will define min/max macros # that will collide with the stl versions. add_definitions(-DNOMINMAX) endif() - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) endif() blender_add_lib(bf_nodes_shader "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 9d216a533a1..66dd95a9d14 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -97,16 +97,4 @@ if(WITH_HYDRA) add_subdirectory(hydra) endif() -if(WITH_TBB) - add_definitions(-DWITH_TBB) - - list(APPEND INC_SYS - ${TBB_INCLUDE_DIRS} - ) - - list(APPEND LIB - ${TBB_LIBRARIES} - ) -endif() - blender_add_lib_nolist(bf_render "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")