blender/intern/mikktspace/CMakeLists.txt
Jesse Yurkovich ec4fc2d34a 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
2024-07-19 23:30:56 +02:00

21 lines
646 B
CMake

# SPDX-FileCopyrightText: 2006 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
add_library(bf_intern_mikktspace INTERFACE)
target_include_directories(bf_intern_mikktspace INTERFACE .)
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.
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19")
set(SRC
mikk_atomic_hash_set.hh
mikk_float3.hh
mikk_util.hh
mikktspace.hh
)
target_sources(bf_intern_mikktspace PRIVATE ${SRC})
blender_source_group(bf_intern_mikktspace ${SRC})
endif()