75 lines
2.9 KiB
Diff
75 lines
2.9 KiB
Diff
src/cmake/externalpackages.cmake | 19 +++++++++++++++++++
|
|
src/include/CMakeLists.txt | 2 +-
|
|
src/libOpenImageIO/CMakeLists.txt | 11 ++++++++++-
|
|
3 files changed, 30 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
|
|
index ddea7e0..aa25df6 100644
|
|
--- a/src/cmake/externalpackages.cmake
|
|
+++ b/src/cmake/externalpackages.cmake
|
|
@@ -272,3 +272,22 @@ if (USE_EXTERNAL_PUGIXML)
|
|
endif()
|
|
|
|
###########################################################################
|
|
+
|
|
+###########################################################################
|
|
+# TBB setup. Normally we just use the version bundled with oiio, but
|
|
+# some linux distros are quite particular about having separate packages so we
|
|
+# allow this to be overridden to use the distro-provided package if desired.
|
|
+#
|
|
+# Try to find it first and fall back to built-in if not available.
|
|
+find_package (TBB REQUIRED)
|
|
+if (TBB_FOUND)
|
|
+ set (USE_EXTERNAL_TBB TRUE CACHE BOOL
|
|
+ "Use system installed TBB library if avaialble."
|
|
+ )
|
|
+ mark_as_advanced (FORCE USE_EXTERNAL_TBB)
|
|
+ # insert include path to TBB first, to ensure that the external
|
|
+ # TBB is found, and not the one in OIIO's include directory.
|
|
+ include_directories (BEFORE ${TBB_INCLUDE_DIR})
|
|
+endif()
|
|
+
|
|
+###########################################################################
|
|
diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt
|
|
index 385f98e..4a2da55 100644
|
|
--- a/src/include/CMakeLists.txt
|
|
+++ b/src/include/CMakeLists.txt
|
|
@@ -23,7 +23,7 @@ list(APPEND public_headers ${CMAKE_BINARY_DIR}/include/version.h)
|
|
install (FILES ${public_headers} DESTINATION ${INCLUDE_INSTALL_DIR}
|
|
COMPONENT developer)
|
|
|
|
-if (USE_TBB)
|
|
+if (USE_TBB AND NOT USE_EXTERNAL_TBB)
|
|
install (DIRECTORY tbb DESTINATION ${INCLUDE_INSTALL_DIR}
|
|
COMPONENT developer)
|
|
endif ()
|
|
diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt
|
|
index f4425f6..62da8dd 100644
|
|
--- a/src/libOpenImageIO/CMakeLists.txt
|
|
+++ b/src/libOpenImageIO/CMakeLists.txt
|
|
@@ -61,7 +61,12 @@ if (NOT USE_EXTERNAL_PUGIXML)
|
|
endif ()
|
|
|
|
# Include our own TBB if using it
|
|
-if (USE_TBB)
|
|
+if (USE_TBB AND USE_EXTERNAL_TBB)
|
|
+ message (STATUS "System TBB library will be used.")
|
|
+ add_definitions ("-DUSE_TBB=1")
|
|
+ set (libOpenImageIO_srcs ${libOpenImageIO_srcs})
|
|
+elseif (USE_TBB AND NOT USE_EXTERNAL_TBB)
|
|
+ message (STATUS "Built-in TBB library will be used.")
|
|
add_definitions ("-DUSE_TBB=1")
|
|
set (libOpenImageIO_srcs ${libOpenImageIO_srcs} ../libutil/tbb_misc.cpp)
|
|
else ()
|
|
@@ -221,6 +226,10 @@ if (USE_EXTERNAL_PUGIXML)
|
|
target_link_libraries (OpenImageIO ${PUGIXML_LIBRARIES})
|
|
endif ()
|
|
|
|
+if (USE_EXTERNAL_TBB)
|
|
+ target_link_libraries (OpenImageIO ${TBB_LIBRARIES})
|
|
+endif ()
|
|
+
|
|
message(STATUS "Setting SOVERSION to: ${SOVERSION}")
|
|
set_target_properties(OpenImageIO
|
|
PROPERTIES
|