[Bf-blender-cvs] [1f95464] master: OpenVDB: Get rid of hardcoded TBB variables and enabled for Linux buildbot

Sergey Sharybin noreply at git.blender.org
Wed Jan 27 12:28:19 CET 2016


Commit: 1f954649c409a50a2a99d94fa3d4fccb9b381b72
Author: Sergey Sharybin
Date:   Wed Jan 27 11:26:26 2016 +0000
Branches: master
https://developer.blender.org/rB1f954649c409a50a2a99d94fa3d4fccb9b381b72

OpenVDB: Get rid of hardcoded TBB variables and enabled for Linux buildbot

===================================================================

M	CMakeLists.txt
M	build_files/buildbot/config/blender_linux.cmake
A	build_files/cmake/Modules/FindTBB.cmake
M	build_files/cmake/macros.cmake
M	intern/openvdb/CMakeLists.txt

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a059cb..014401a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1063,19 +1063,11 @@ if(UNIX AND NOT APPLE)
 
 	if(WITH_OPENVDB)
 		find_package_wrapper(OpenVDB)
-
-		set(TBB ${LIBDIR}/tbb)
-		set(TBB_LIBRARIES tbb)
-		set(TBB_LIBPATH ${TBB}/lib)
-
-		set(OPENVDB_LIBRARIES ${OPENVDB_LIBRARIES} ${BOOST_LIBRARIES} ${ZLIB_LIBRARIES} ${TBB_LIBRARIES})
-		set(OPENVDB_LIBPATH)  # TODO, remove and reference the absolute path everywhere
-		set(OPENVDB_DEFINITIONS)
-
-		if(NOT OPENVDB_FOUND)
+		find_package_wrapper(TBB)
+		if(NOT OPENVDB_FOUND OR NOT TBB_FOUND)
 			set(WITH_OPENVDB OFF)
 			set(WITH_OPENVDB_BLOSC OFF)
-			message(STATUS "OpenVDB not found")
+			message(STATUS "OpenVDB not found, disabling it")
 		endif()
 	endif()
 
diff --git a/build_files/buildbot/config/blender_linux.cmake b/build_files/buildbot/config/blender_linux.cmake
index 4090941..1437b75 100644
--- a/build_files/buildbot/config/blender_linux.cmake
+++ b/build_files/buildbot/config/blender_linux.cmake
@@ -101,5 +101,8 @@ set(PNG_LIBRARY         "/usr/lib/libpng.a"   CACHE STRING "" FORCE)
 set(TIFF_LIBRARY        "/usr/lib/libtiff.a"  CACHE STRING "" FORCE)
 set(ZLIB_LIBRARY        "/usr/lib/libz.a"     CACHE STRING "" FORCE)
 
+# OpenVDB
+set(WITH_OPENVDB       ON  CACHE BOOL "" FORCE)
+
 # Additional linking libraries
 set(CMAKE_EXE_LINKER_FLAGS   "-lrt -static-libstdc++"  CACHE STRING "" FORCE)
diff --git a/build_files/cmake/Modules/FindTBB.cmake b/build_files/cmake/Modules/FindTBB.cmake
new file mode 100644
index 0000000..8a821f8
--- /dev/null
+++ b/build_files/cmake/Modules/FindTBB.cmake
@@ -0,0 +1,73 @@
+# - Find TBB library
+# Find the native TBB includes and library
+# This module defines
+#  TBB_INCLUDE_DIRS, where to find tbb.h, Set when
+#                    TBB is found.
+#  TBB_LIBRARIES, libraries to link against to use TBB.
+#  TBB_ROOT_DIR, The base directory to search for TBB.
+#                This can also be an environment variable.
+#  TBB_FOUND, If false, do not try to use TBB.
+#
+# also defined, but not for general use are
+#  TBB_LIBRARY, where to find the TBB library.
+
+#=============================================================================
+# Copyright 2016 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If TBB_ROOT_DIR was defined in the environment, use it.
+IF(NOT TBB_ROOT_DIR AND NOT $ENV{TBB_ROOT_DIR} STREQUAL "")
+  SET(TBB_ROOT_DIR $ENV{TBB_ROOT_DIR})
+ENDIF()
+
+SET(_tbb_SEARCH_DIRS
+  ${TBB_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+  /opt/lib/tbb
+)
+
+FIND_PATH(TBB_INCLUDE_DIR
+  NAMES
+    tbb/tbb.h
+  HINTS
+    ${_tbb_SEARCH_DIRS}
+  PATH_SUFFIXES
+    include
+)
+
+FIND_LIBRARY(TBB_LIBRARY
+  NAMES
+    tbb
+  HINTS
+    ${_tbb_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+# handle the QUIETLY and REQUIRED arguments and set TBB_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG
+    TBB_LIBRARY TBB_INCLUDE_DIR)
+
+IF(TBB_FOUND)
+  SET(TBB_LIBRARIES ${TBB_LIBRARY})
+  SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
+ELSE()
+  SET(TBB_TBB_FOUND FALSE)
+ENDIF()
+
+MARK_AS_ADVANCED(
+  TBB_INCLUDE_DIR
+  TBB_LIBRARY
+)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 28617cd..a5b29b4 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -404,7 +404,7 @@ function(setup_liblinks
 		endif()
 	endif()
 	if(WITH_OPENVDB)
-		target_link_libraries(${target} ${OPENVDB_LIBRARIES})
+		target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES})
 	endif()
 	if(WITH_CYCLES_OSL)
 		target_link_libraries(${target} ${OSL_LIBRARIES})
diff --git a/intern/openvdb/CMakeLists.txt b/intern/openvdb/CMakeLists.txt
index ce683e7..e0ecdb5 100644
--- a/intern/openvdb/CMakeLists.txt
+++ b/intern/openvdb/CMakeLists.txt
@@ -42,6 +42,7 @@ if(WITH_OPENVDB)
 
 	list(APPEND INC_SYS
 		${BOOST_INCLUDE_DIR}
+		${TBB_INCLUDE_DIRS}
 		${OPENEXR_INCLUDE_DIRS}
 		${OPENVDB_INCLUDE_DIRS}
 	)




More information about the Bf-blender-cvs mailing list