BuildSystem/Cleanup: Fix warning behaviour regarding library dependencies
authorRay Molenkamp <github@lazydodo.com>
Fri, 7 Feb 2020 14:27:40 +0000 (07:27 -0700)
committerRay Molenkamp <github@lazydodo.com>
Fri, 7 Feb 2020 14:27:40 +0000 (07:27 -0700)
Adding USD to a lite build fails to build due to boost errors, when you turn
boost on and rebuild still boost errors, boost was silently turned off since
it was not deemed needed. Once boost was forced on, it still fails due to TBB
being off.

This patch fixes:

- The Silent disabling of boost
- Add a check that USD is is not on before doing that
- move the TBB checks to a central location rather than the individual platform files
- Add USD to the TBB checks.

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

Reviewers: brecht, sybren

CMakeLists.txt
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

index 509de9943e25364bfd75f847ab6f5abc0611d3df..60656a9e4fa9c8bdeddf967723534275ddbe9e45 100644 (file)
@@ -613,29 +613,25 @@ endif()
 
 # enable boost for cycles, audaspace or i18n
 # otherwise if the user disabled
-if(NOT WITH_BOOST)
-  # Explicitly disabled. so disable all deps.
-  macro(set_and_warn
-    _setting _val)
-    if(${${_setting}})
-      message(STATUS "'WITH_BOOST' is disabled: forcing 'set(${_setting} ${_val})'")
-    endif()
-    set(${_setting} ${_val})
-  endmacro()
-
-  set_and_warn(WITH_CYCLES         OFF)
-  set_and_warn(WITH_INTERNATIONAL  OFF)
-  set_and_warn(WITH_OPENVDB        OFF)
-  set_and_warn(WITH_OPENCOLORIO    OFF)
-  set_and_warn(WITH_QUADRIFLOW     OFF)
-elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
-       WITH_OPENVDB OR WITH_OPENCOLORIO)
-  # Keep enabled
-else()
-  # Disable boost if not needed.
+
+set_and_warn_dependency(WITH_BOOST WITH_CYCLES         OFF)
+set_and_warn_dependency(WITH_BOOST WITH_INTERNATIONAL  OFF)
+set_and_warn_dependency(WITH_BOOST WITH_OPENVDB        OFF)
+set_and_warn_dependency(WITH_BOOST WITH_OPENCOLORIO    OFF)
+set_and_warn_dependency(WITH_BOOST WITH_QUADRIFLOW     OFF)
+set_and_warn_dependency(WITH_BOOST WITH_USD            OFF)
+
+if(NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
+   WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD))
+  message(STATUS "No dependencies need 'WITH_BOOST' forcing WITH_BOOST=OFF")
   set(WITH_BOOST OFF)
 endif()
 
+set_and_warn_dependency(WITH_TBB WITH_USD               OFF)
+set_and_warn_dependency(WITH_TBB WITH_OPENIMAGEDENOISE  OFF)
+set_and_warn_dependency(WITH_TBB WITH_OPENVDB           OFF)
+set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID         OFF)
+
 # auto enable openimageio for cycles
 if(WITH_CYCLES)
   set(WITH_OPENIMAGEIO ON)
index 2d13476f09ab09e8ff27b772597c3001ffbb262e..daf156bc3f2e56ecc15b5196232f9bf74421bb35 100644 (file)
@@ -1157,3 +1157,13 @@ macro(blender_precompile_headers target cpp header)
     set_source_files_properties(${cpp} PROPERTIES COMPILE_FLAGS "/Yc${header} /Fp${pchfinal}")
   endif()
 endmacro()
+
+macro(set_and_warn_dependency
+    _dependency _setting _val)
+    # when $_dependency is disabled, forces $_setting = $_val
+    if(NOT ${${_dependency}} AND ${${_setting}})
+      message(STATUS "'${_dependency}' is disabled: forcing 'set(${_setting} ${_val})'")
+      set(${_setting} ${_val})
+    endif()
+endmacro()
+
index a4de3876243cae012bcbb61c6b7f0bfd4afe8ac8..b231a2b6fa4bfa128e95826a360f6cdc6449bec8 100644 (file)
@@ -398,21 +398,6 @@ 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)
-  endif()
-  if(WITH_OPENVDB)
-    message(STATUS "TBB not found, disabling OpenVDB")
-    set(WITH_OPENVDB OFF)
-  endif()
-  if(WITH_MOD_FLUID)
-    message(STATUS "TBB not found, disabling Fluid modifier")
-    set(WITH_MOD_FLUID OFF)
-  endif()
-endif()
-
 # CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
 if(WITH_OPENMP)
   if(CMAKE_C_COMPILER_ID MATCHES "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0")
index 2f9f39b46d9232bb8039740c1e39e3d4bb79e857..91f836d52659a4b78ca91f1553ada2a715994638 100644 (file)
@@ -448,17 +448,6 @@ 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 04e5848dcfe08c52c2ccee5cca61da8958aae628..4241f307abc2edd809b8b27c6e73b1ab6455d1bd 100644 (file)
@@ -570,19 +570,6 @@ if(WITH_TBB)
   if(WITH_TBB_MALLOC_PROXY)
     add_definitions(-DWITH_TBB_MALLOC)
   endif()
-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()
-  if(WITH_MOD_FLUID)
-    message(STATUS "TBB disabled, disabling Fluid modifier")
-    set(WITH_MOD_FLUID OFF)
-  endif()
 endif()
 
 # used in many places so include globally, like OpenGL