CMake: Add WITH_TBB definition to prevent ODR violation for BLI_spin API

The BLI_spin APIs use a `SpinLock` typedef whose underlying type is
contingent on the precense of `WITH_TBB`. Since our projects did not
consistently define the `WITH_TBB` definition, multiple `SpinLock` types
would end up in our final binary creating ODR violations.

Pull Request: https://projects.blender.org/blender/blender/pulls/124285
This commit is contained in:
Jesse Yurkovich
2024-07-10 23:02:17 +02:00
committed by Jesse Yurkovich
parent 05241f47f5
commit 57544887d0
5 changed files with 62 additions and 3 deletions

View File

@@ -168,6 +168,18 @@ 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()

View File

@@ -53,6 +53,17 @@ 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}")

View File

@@ -62,6 +62,18 @@ 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}")
# RNA_prototypes.h dna_type_offsets.h

View File

@@ -834,6 +834,19 @@ if(WITH_OPENCOLORIO)
add_definitions(-DWITH_OCIO)
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

View File

@@ -93,9 +93,20 @@ if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
blender_add_lib_nolist(bf_render "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
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}")