CMake: Modernize the optional TBB dependency

This continues the cmake modernization effort and introduces support for
allowing our optional dependencies to integrate properly. TBB is added
here as it's proven troublesome to maintain correctly.

Currently the only Blender project which uses the TBB headers directly
is `blenlib`.  However, all downstream projects which require blenlib as
their dependency, and wish to properly make use of its threading
facilities, needed to define various TBB items in their CMake files. Not
only is this unnecessary and arcane, but several projects didn't do this
and ended up not using threading as well as producing ODR violations
along the way[1].

This PR makes TBB a modern dependency and exposes it PUBLIC'ly from
`blenlib`.  All downstream projects which depend on blenlib will now
receive everything they require from TBB automatically. This includes
the `WITH_TBB` define, the headers, and the library itself.

[1] blender/blender@05241f47f5

Pull Request: https://projects.blender.org/blender/blender/pulls/124916
This commit is contained in:
Jesse Yurkovich 2024-07-19 23:30:56 +02:00 committed by Jesse Yurkovich
parent 108b71047a
commit ec4fc2d34a
40 changed files with 41 additions and 320 deletions

View file

@ -1679,6 +1679,10 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
endif() endif()
endif() endif()
# -----------------------------------------------------------------------------
# Common dependency targets
include(dependency_targets)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Ninja Job Limiting # Ninja Job Limiting

View file

@ -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()

View file

@ -86,15 +86,6 @@ if(WITH_MANTA_NUMPY AND WITH_PYTHON_NUMPY)
) )
endif() endif()
if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
list(APPEND INC_SYS list(APPEND INC_SYS
${OPENVDB_INCLUDE_DIRS} ${OPENVDB_INCLUDE_DIRS}
@ -245,6 +236,7 @@ if(WITH_MANTA_NUMPY AND WITH_PYTHON_NUMPY)
endif() endif()
set(LIB set(LIB
PRIVATE bf::dependencies::optional::tbb
${PYTHON_LINKFLAGS} ${PYTHON_LINKFLAGS}
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
) )

View file

@ -38,15 +38,6 @@ set(INC_SYS
${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS}
) )
if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)
add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS}) add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
list(APPEND INC_SYS list(APPEND INC_SYS
@ -74,6 +65,7 @@ set(LIB
PRIVATE bf::blenlib PRIVATE bf::blenlib
PRIVATE bf::dna PRIVATE bf::dna
PRIVATE bf::intern::guardedalloc PRIVATE bf::intern::guardedalloc
PRIVATE bf::dependencies::optional::tbb
extern_mantaflow extern_mantaflow
${PYTHON_LINKFLAGS} ${PYTHON_LINKFLAGS}

View file

@ -5,11 +5,7 @@
add_library(bf_intern_mikktspace INTERFACE) add_library(bf_intern_mikktspace INTERFACE)
target_include_directories(bf_intern_mikktspace INTERFACE .) target_include_directories(bf_intern_mikktspace INTERFACE .)
if(WITH_TBB) target_link_libraries(bf_intern_mikktspace INTERFACE bf::dependencies::optional::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()
# CMake 3.19+ allows one to populate the interface library with # CMake 3.19+ allows one to populate the interface library with
# source files to show in the IDE. # source files to show in the IDE.

View file

@ -806,18 +806,6 @@ if(WITH_XR_OPENXR)
add_definitions(-DWITH_XR_OPENXR) add_definitions(-DWITH_XR_OPENXR)
endif() 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) if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_ANIM_BAKLAVA) add_definitions(-DWITH_ANIM_BAKLAVA)
endif() endif()

View file

@ -412,6 +412,7 @@ set(LIB
extern_wcwidth extern_wcwidth
PRIVATE bf::intern::atomic PRIVATE bf::intern::atomic
PRIVATE extern_fmtlib PRIVATE extern_fmtlib
PUBLIC bf::dependencies::optional::tbb
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${ZSTD_LIBRARIES} ${ZSTD_LIBRARIES}
) )
@ -428,18 +429,6 @@ if(WITH_MEM_VALGRIND)
add_definitions(-DWITH_MEM_VALGRIND) add_definitions(-DWITH_MEM_VALGRIND)
endif() endif()
if(WITH_TBB)
add_definitions(-DWITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif()
if(WITH_GMP) if(WITH_GMP)
add_definitions(-DWITH_GMP) add_definitions(-DWITH_GMP)

View file

@ -83,13 +83,6 @@ if(WITH_ALEMBIC)
add_definitions(-DWITH_ALEMBIC) add_definitions(-DWITH_ALEMBIC)
endif() endif()
if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
add_definitions(-DWITH_TBB)
endif()
if(WIN32) if(WIN32)
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()

View file

@ -202,19 +202,11 @@ if(WITH_GMP)
endif() endif()
if(WITH_TBB) if(WITH_TBB)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif() endif()
blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View file

@ -576,10 +576,6 @@ if(WITH_COMPOSITOR_CPU)
) )
if(WITH_TBB) if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.

View file

@ -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}") file(GENERATE OUTPUT ${shader_create_info_list_file} CONTENT "${SHADER_CREATE_INFOS_CONTENT}")
if(WITH_TBB) if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.

View file

@ -168,18 +168,6 @@ if(WITH_PYTHON)
) )
endif() 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) if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_ANIM_BAKLAVA) add_definitions(-DWITH_ANIM_BAKLAVA)
endif() endif()

View file

@ -844,21 +844,11 @@ if(WITH_GTESTS)
endif() endif()
if(WITH_TBB) if(WITH_TBB)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif() endif()
blender_add_lib(bf_draw "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") blender_add_lib(bf_draw "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View file

@ -41,18 +41,6 @@ set(LIB
PRIVATE bf::intern::guardedalloc 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}") blender_add_lib(bf_editor_curve "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# RNA_prototypes.hh # RNA_prototypes.hh

View file

@ -44,10 +44,6 @@ set(LIB
) )
if(WITH_TBB) if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.

View file

@ -50,17 +50,5 @@ set(LIB
extern_fmtlib 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}") blender_add_lib(bf_editor_grease_pencil "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
add_dependencies(bf_editor_curves bf_rna) add_dependencies(bf_editor_curves bf_rna)

View file

@ -85,18 +85,6 @@ if(WITH_GMP)
add_definitions(-DWITH_GMP) add_definitions(-DWITH_GMP)
endif() 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}") blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# RNA_prototypes.hh # RNA_prototypes.hh

View file

@ -60,10 +60,6 @@ if(WITH_FREESTYLE)
endif() endif()
if(WITH_TBB) if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.

View file

@ -166,13 +166,6 @@ set(LIB
PRIVATE bf::intern::guardedalloc PRIVATE bf::intern::guardedalloc
) )
if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
add_definitions(-DWITH_TBB)
endif()
if(WIN32) if(WIN32)
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()

View file

@ -53,18 +53,6 @@ set(LIB
PRIVATE bf::intern::guardedalloc 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}") blender_add_lib(bf_editor_space_clip "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# RNA_prototypes.hh # RNA_prototypes.hh

View file

@ -62,17 +62,6 @@ if(WITH_IMAGE_WEBP)
add_definitions(-DWITH_WEBP) add_definitions(-DWITH_WEBP)
endif() 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}") blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View file

@ -90,19 +90,11 @@ if(WITH_OPENVDB)
endif() endif()
if(WITH_TBB) if(WITH_TBB)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif() endif()
blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View file

@ -76,16 +76,6 @@ if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE)
endif() 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}") blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View file

@ -106,18 +106,6 @@ if(WITH_XR_OPENXR)
add_definitions(-DWITH_XR_OPENXR) add_definitions(-DWITH_XR_OPENXR)
endif() 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}") blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# RNA_prototypes.hh # RNA_prototypes.hh

View file

@ -128,18 +128,6 @@ set(LIB
PRIVATE bf::intern::guardedalloc 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}") blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# RNA_prototypes.hh # RNA_prototypes.hh

View file

@ -48,19 +48,11 @@ set(LIB
) )
if(WITH_TBB) if(WITH_TBB)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif() endif()
blender_add_lib(bf_functions "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") blender_add_lib(bf_functions "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View file

@ -114,18 +114,6 @@ if(WITH_OPENVDB)
add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS}) add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
endif() endif()
if(WITH_TBB)
add_definitions(-DWITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif()
if(WITH_GMP) if(WITH_GMP)
add_definitions(-DWITH_GMP) add_definitions(-DWITH_GMP)

View file

@ -72,19 +72,11 @@ set(SRC
) )
if(WITH_TBB) if(WITH_TBB)
add_definitions(-DWITH_TBB) if(WIN32)
if(WIN32) # TBB includes Windows.h which will define min/max macros
# TBB includes Windows.h which will define min/max macros # that will collide with the stl versions.
# that will collide with the stl versions. add_definitions(-DNOMINMAX)
add_definitions(-DNOMINMAX) endif()
endif()
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif() endif()
set(LIB set(LIB

View file

@ -837,18 +837,6 @@ if(WITH_OPENCOLORIO)
endif() 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}") blender_add_lib(bf_gpu "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
target_link_libraries(bf_gpu PUBLIC target_link_libraries(bf_gpu PUBLIC
bf_compositor_shaders bf_compositor_shaders

View file

@ -161,18 +161,6 @@ if(WITH_IMAGE_WEBP)
add_definitions(-DWITH_WEBP) add_definitions(-DWITH_WEBP)
endif() endif()
if(WITH_TBB)
add_definitions(-DWITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif()
list(APPEND INC list(APPEND INC
../../../intern/opencolorio ../../../intern/opencolorio
) )

View file

@ -102,18 +102,6 @@ if(WITH_BOOST)
) )
endif() 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}") blender_add_lib(bf_io_alembic "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_GTESTS) if(WITH_GTESTS)

View file

@ -27,7 +27,6 @@ endif()
# USD headers use deprecated TBB headers, silence warning. # USD headers use deprecated TBB headers, silence warning.
add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1) add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
add_definitions(-DWITH_TBB)
# Check if USD has the imaging headers available, if they are # Check if USD has the imaging headers available, if they are
# add a USD_HAS_IMAGING define so code can dynamically detect this. # add a USD_HAS_IMAGING define so code can dynamically detect this.

View file

@ -62,12 +62,6 @@ set(LIB
PRIVATE bf::extern::fmtlib 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}") blender_add_lib(bf_io_wavefront_obj "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_GTESTS) if(WITH_GTESTS)

View file

@ -18,6 +18,7 @@ set(INC_SYS
set(LIB set(LIB
PRIVATE bf::intern::atomic PRIVATE bf::intern::atomic
PRIVATE bf::intern::guardedalloc PRIVATE bf::intern::guardedalloc
PRIVATE bf::dependencies::optional::tbb
) )
add_definitions(-DWITH_DNA_GHASH) add_definitions(-DWITH_DNA_GHASH)
@ -159,6 +160,7 @@ set(SRC
set(LIB set(LIB
PRIVATE bf::intern::atomic PRIVATE bf::intern::atomic
PRIVATE bf::intern::guardedalloc PRIVATE bf::intern::guardedalloc
PRIVATE bf::dependencies::optional::tbb
) )
blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View file

@ -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::atomic)
target_link_libraries(makesrna PRIVATE bf::intern::guardedalloc) target_link_libraries(makesrna PRIVATE bf::intern::guardedalloc)
target_link_libraries(makesrna PRIVATE bf_dna_blenlib) target_link_libraries(makesrna PRIVATE bf_dna_blenlib)
target_link_libraries(makesrna PRIVATE bf::dependencies::optional::tbb)
if(WIN32 AND NOT UNIX) if(WIN32 AND NOT UNIX)
if(DEFINED PTHREADS_LIBRARIES) if(DEFINED PTHREADS_LIBRARIES)
@ -484,6 +485,7 @@ set(SRC
set(LIB set(LIB
PRIVATE bf::animrig PRIVATE bf::animrig
PRIVATE bf::dna PRIVATE bf::dna
PRIVATE bf::dependencies::optional::tbb
PRIVATE extern_fmtlib PRIVATE extern_fmtlib
bf_editor_space_api bf_editor_space_api

View file

@ -214,19 +214,11 @@ if(WITH_GMP)
endif() endif()
if(WITH_TBB) if(WITH_TBB)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif() endif()
if(WITH_OPENVDB) if(WITH_OPENVDB)

View file

@ -160,10 +160,6 @@ if(WITH_BULLET)
endif() endif()
if(WITH_TBB) if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.

View file

@ -276,10 +276,6 @@ if(WITH_BULLET)
endif() endif()
if(WITH_TBB) if(WITH_TBB)
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.

View file

@ -170,19 +170,11 @@ if(WITH_FREESTYLE)
endif() endif()
if(WITH_TBB) if(WITH_TBB)
add_definitions(-DWITH_TBB)
if(WIN32) if(WIN32)
# TBB includes Windows.h which will define min/max macros # TBB includes Windows.h which will define min/max macros
# that will collide with the stl versions. # that will collide with the stl versions.
add_definitions(-DNOMINMAX) add_definitions(-DNOMINMAX)
endif() endif()
list(APPEND INC_SYS
${TBB_INCLUDE_DIRS}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
endif() endif()
blender_add_lib(bf_nodes_shader "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") blender_add_lib(bf_nodes_shader "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View file

@ -97,16 +97,4 @@ if(WITH_HYDRA)
add_subdirectory(hydra) add_subdirectory(hydra)
endif() 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}") blender_add_lib_nolist(bf_render "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")