Build: add WITH_TBB option, in preparation of sculpt using it
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 9 Oct 2019 14:44:29 +0000 (16:44 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 10 Oct 2019 15:35:35 +0000 (17:35 +0200)
It should no longer be tied to OpenVDB and OpenImageDenoise then.

Differential Revision: https://developer.blender.org/D6029

CMakeLists.txt
build_files/cmake/config/blender_full.cmake
build_files/cmake/config/blender_lite.cmake
build_files/cmake/config/blender_release.cmake
build_files/cmake/macros.cmake
build_files/cmake/platform/platform_apple.cmake
build_files/cmake/platform/platform_unix.cmake
build_files/cmake/platform/platform_win32.cmake
source/blender/compositor/CMakeLists.txt

index 43a0994e642682de5c3a83049e59b6f156f048bd..b6fe32149e2a523bfa483cbae4fc365677f28237 100644 (file)
@@ -460,7 +460,8 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC)
 option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
 mark_as_advanced(WITH_ASSERT_ABORT)
 
-option(WITH_BOOST                   "Enable features depending on boost" ON)
+option(WITH_BOOST "Enable features depending on boost" ON)
+option(WITH_TBB   "Enable features depending on TBB (OpenVDB, OpenImageDenoise, sculpt multithreading)" ON)
 
 # Unit testsing
 option(WITH_GTESTS "Enable GTest unit testing" OFF)
index 403d38f6a05e41c76d8a2c224500239807298177..4c47c4c4dba17b93fe07ff9969913d92d65541e3 100644 (file)
@@ -49,6 +49,7 @@ set(WITH_PYTHON_INSTALL      ON  CACHE BOOL "" FORCE)
 set(WITH_QUADRIFLOW          ON  CACHE BOOL "" FORCE)
 set(WITH_RAYOPTIMIZATION     ON  CACHE BOOL "" FORCE)
 set(WITH_SDL                 ON  CACHE BOOL "" FORCE)
+set(WITH_TBB                 ON  CACHE BOOL "" FORCE)
 set(WITH_X11_XINPUT          ON  CACHE BOOL "" FORCE)
 set(WITH_X11_XF86VMODE       ON  CACHE BOOL "" FORCE)
 
index 37cbfa27972d5c62d4c4c3500e72be1d9d467a3e..6d0f160c76455dd7f564574ef494f17ddcddb3ab 100644 (file)
@@ -54,5 +54,6 @@ set(WITH_OPENVDB             OFF CACHE BOOL "" FORCE)
 set(WITH_QUADRIFLOW          OFF CACHE BOOL "" FORCE)
 set(WITH_RAYOPTIMIZATION     OFF CACHE BOOL "" FORCE)
 set(WITH_SDL                 OFF CACHE BOOL "" FORCE)
+set(WITH_TBB                 OFF CACHE BOOL "" FORCE)
 set(WITH_X11_XINPUT          OFF CACHE BOOL "" FORCE)
 set(WITH_X11_XF86VMODE       OFF CACHE BOOL "" FORCE)
index cb338f40a7ba6862817301f1c8437d8c0594eadd..cf849519c83cecb69afa801ab491a40e3807141f 100644 (file)
@@ -50,6 +50,7 @@ set(WITH_PYTHON_INSTALL      ON  CACHE BOOL "" FORCE)
 set(WITH_QUADRIFLOW          ON  CACHE BOOL "" FORCE)
 set(WITH_RAYOPTIMIZATION     ON  CACHE BOOL "" FORCE)
 set(WITH_SDL                 ON  CACHE BOOL "" FORCE)
+set(WITH_TBB                 ON  CACHE BOOL "" FORCE)
 set(WITH_X11_XINPUT          ON  CACHE BOOL "" FORCE)
 set(WITH_X11_XF86VMODE       ON  CACHE BOOL "" FORCE)
 
index f642a19991521787eeb64a26cc23510e89b75683..c3025be34bafa3fd113c7e9fc74d10743cbd8d58 100644 (file)
@@ -460,13 +460,16 @@ function(setup_liblinks
     target_link_libraries(${target} ${OSL_LIBRARIES})
   endif()
   if(WITH_OPENVDB)
-    target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
+    target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${BLOSC_LIBRARIES})
   endif()
   if(WITH_OPENIMAGEIO)
     target_link_libraries(${target} ${OPENIMAGEIO_LIBRARIES})
   endif()
   if(WITH_OPENIMAGEDENOISE)
-    target_link_libraries(${target} ${OPENIMAGEDENOISE_LIBRARIES} ${TBB_LIBRARIES})
+    target_link_libraries(${target} ${OPENIMAGEDENOISE_LIBRARIES})
+  endif()
+  if(WITH_TBB)
+    target_link_libraries(${target} ${TBB_LIBRARIES})
   endif()
   if(WITH_OPENCOLORIO)
     target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
index 249546dd21619c4972665e3364502d0e75342300..5cea7a418bdbbe7b764143bacd838b76d0289280 100644 (file)
@@ -313,9 +313,7 @@ endif()
 if(WITH_OPENVDB)
   set(OPENVDB ${LIBDIR}/openvdb)
   set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
-  set(TBB_INCLUDE_DIRS ${LIBDIR}/tbb/include)
-  set(TBB_LIBRARIES ${LIBDIR}/tbb/lib/libtbb.a)
-  set(OPENVDB_LIBRARIES openvdb blosc ${TBB_LIBRARIES})
+  set(OPENVDB_LIBRARIES openvdb blosc)
   set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
   set(OPENVDB_DEFINITIONS)
 endif()
@@ -386,14 +384,25 @@ endif()
 
 if(WITH_OPENIMAGEDENOISE)
   find_package(OpenImageDenoise)
-  find_package(TBB)
 
   if(NOT OPENIMAGEDENOISE_FOUND)
     set(WITH_OPENIMAGEDENOISE OFF)
     message(STATUS "OpenImageDenoise not found")
-  elseif(NOT TBB_FOUND)
+  endif()
+endif()
+
+if(WITH_TBB)
+  find_package(TBB)
+endif()
+
+if(NOT WITH_TBB OR NOT TBB_FOUND)
+  if(WITH_OPENIMAGEDENOISE)
+    message(STATUS "TBB not found, disabling OpenImageDenoise")
     set(WITH_OPENIMAGEDENOISE OFF)
-    message(STATUS "TBB not found")
+  endif()
+  if(WITH_OPENVDB)
+    message(STATUS "TBB not found, disabling OpenVDB")
+    set(WITH_OPENVDB OFF)
   endif()
 endif()
 
index e655234eb34fa89eddc9672060d1306b591b3ffe..c48780ebd6a13d5341b37661467f74b881f8ab56 100644 (file)
@@ -260,13 +260,8 @@ endif()
 
 if(WITH_OPENVDB)
   find_package_wrapper(OpenVDB)
-  find_package_wrapper(TBB)
   find_package_wrapper(Blosc)
-  if(NOT TBB_FOUND)
-    set(WITH_OPENVDB OFF)
-    set(WITH_OPENVDB_BLOSC OFF)
-    message(STATUS "TBB not found, disabling OpenVDB")
-  elseif(NOT OPENVDB_FOUND)
+  if(NOT OPENVDB_FOUND)
     set(WITH_OPENVDB OFF)
     set(WITH_OPENVDB_BLOSC OFF)
     message(STATUS "OpenVDB not found, disabling it")
@@ -432,6 +427,21 @@ if(WITH_OPENSUBDIV)
   endif()
 endif()
 
+if(WITH_TBB)
+  find_package_wrapper(TBB)
+endif()
+
+if(NOT WITH_TBB OR NOT TBB_FOUND)
+  if(WITH_OPENIMAGEDENOISE)
+    message(STATUS "TBB not found, disabling OpenImageDenoise")
+    set(WITH_OPENIMAGEDENOISE OFF)
+  endif()
+  if(WITH_OPENVDB)
+    message(STATUS "TBB not found, disabling OpenVDB")
+    set(WITH_OPENVDB OFF)
+  endif()
+endif()
+
 # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
 if(HAIKU)
   list(APPEND PLATFORM_LINKLIBS -lnetwork)
index 7956a2993201f7acb75802ef06b365409acc8457..f64dd4a4aa33d461791aa9555469190445f58501 100644 (file)
@@ -491,25 +491,20 @@ endif()
 
 if(WITH_OPENVDB)
   set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib)
-  set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
-  set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
   set(OPENVDB ${LIBDIR}/openVDB)
   set(OPENVDB_LIBPATH ${OPENVDB}/lib)
-  set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
-  set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
+  set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
+  set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${BLOSC_LIBRARIES})
   set(OPENVDB_DEFINITIONS -DNOMINMAX)
 endif()
 
 if(WITH_OPENIMAGEDENOISE)
-  set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
-  set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
   set(OPENIMAGEDENOISE ${LIBDIR}/OpenImageDenoise)
   set(OPENIMAGEDENOISE_LIBPATH ${LIBDIR}/OpenImageDenoise/lib)
-  set(OPENIMAGEDENOISE_INCLUDE_DIRS ${OPENIMAGEDENOISE}/include ${TBB_INCLUDE_DIR})
+  set(OPENIMAGEDENOISE_INCLUDE_DIRS ${OPENIMAGEDENOISE}/include)
   set(OPENIMAGEDENOISE_LIBRARIES
     optimized ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise.lib ${OPENIMAGEDENOISE_LIBPATH}/common.lib ${OPENIMAGEDENOISE_LIBPATH}/mkldnn.lib
-    debug ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise_d.lib ${OPENIMAGEDENOISE_LIBPATH}/common_d.lib ${OPENIMAGEDENOISE_LIBPATH}/mkldnn_d.lib
-    ${TBB_LIBRARIES})
+    debug ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise_d.lib ${OPENIMAGEDENOISE_LIBPATH}/common_d.lib ${OPENIMAGEDENOISE_LIBPATH}/mkldnn_d.lib)
   set(OPENIMAGEDENOISE_DEFINITIONS)
 endif()
 
@@ -574,6 +569,20 @@ if(WITH_SYSTEM_AUDASPACE)
   set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
 endif()
 
+if(WITH_TBB)
+  set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
+  set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
+else()
+  if(WITH_OPENIMAGEDENOISE)
+    message(STATUS "TBB disabled, also disabling OpenImageDenoise")
+    set(WITH_OPENIMAGEDENOISE OFF)
+  endif()
+  if(WITH_OPENVDB)
+    message(STATUS "TBB disabled, also disabling OpenVDB")
+    set(WITH_OPENVDB OFF)
+  endif()
+endif()
+
 # used in many places so include globally, like OpenGL
 blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
 
index 2a8914c8cd9e21e106518ad5e050739f451d0e40..f0685b169fa7ad881d572f21be2240ebfd8157c2 100644 (file)
@@ -566,6 +566,7 @@ if(WITH_OPENIMAGEDENOISE)
   add_definitions(-DOIDN_STATIC_LIB)
   list(APPEND INC_SYS
     ${OPENIMAGEDENOISE_INCLUDE_DIRS}
+    ${TBB_INCLUDE_DIRS}
   )
 endif()