Add missing patch.

This commit is contained in:
Richard M. Shaw 2012-01-05 13:39:56 -06:00
parent 989180a79f
commit 55e2849c87
2 changed files with 74 additions and 25 deletions

View File

@ -0,0 +1,74 @@
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

View File

@ -1,25 +0,0 @@
diff -Naur OpenImageIO-oiio-7d98ca6.orig/src/libOpenImageIO/CMakeLists.txt OpenImageIO-oiio-7d98ca6/src/libOpenImageIO/CMakeLists.txt
--- OpenImageIO-oiio-7d98ca6.orig/src/libOpenImageIO/CMakeLists.txt 2011-11-05 14:58:12.807482262 -0500
+++ OpenImageIO-oiio-7d98ca6/src/libOpenImageIO/CMakeLists.txt 2011-11-05 15:24:19.934139140 -0500
@@ -62,7 +62,7 @@
# Include our own TBB if using it
if (USE_TBB)
add_definitions ("-DUSE_TBB=1")
- set (libOpenImageIO_srcs ${libOpenImageIO_srcs} ../libutil/tbb_misc.cpp)
+ include_directories(SYSTEM "/usr/include")
else ()
add_definitions ("-DUSE_TBB=0")
message (STATUS "TBB will not be used")
diff -Naur OpenImageIO-oiio-7d98ca6.orig/src/include/CMakeLists.txt OpenImageIO-oiio-7d98ca6/src/include/CMakeLists.txt
--- OpenImageIO-oiio-7d98ca6.orig/src/include/CMakeLists.txt 2011-11-05 15:42:23.297182938 -0500
+++ OpenImageIO-oiio-7d98ca6/src/include/CMakeLists.txt 2011-11-05 16:01:10.691264012 -0500
@@ -21,9 +21,3 @@
install (FILES ${public_headers} DESTINATION ${INCLUDE_INSTALL_DIR}
COMPONENT developer)
-
-if (USE_TBB)
- install (DIRECTORY tbb DESTINATION ${INCLUDE_INSTALL_DIR}
- COMPONENT developer)
-endif ()
-