[Bf-blender-cvs] [c5e1cd44596] tmp_lib_update_32: Deps_Builder: USD Enable imaging components

Ray Molenkamp noreply at git.blender.org
Thu Mar 17 17:59:42 CET 2022


Commit: c5e1cd44596d8554d51af36701a66a43fc261fe2
Author: Ray Molenkamp
Date:   Thu Mar 17 10:59:35 2022 -0600
Branches: tmp_lib_update_32
https://developer.blender.org/rBc5e1cd44596d8554d51af36701a66a43fc261fe2

Deps_Builder: USD Enable imaging components

- Enable Imaging components for USD
- Revert USD Back to static on windows as linking dynamically lead to more code duplication in the binaries than i'd like when enabling imaging linking in OIIO+OSL+friends
- Add missing dependencies on RobinMap and fmt to oiio

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

M	build_files/build_environment/cmake/openimageio.cmake
M	build_files/build_environment/cmake/usd.cmake
M	build_files/cmake/platform/platform_win32.cmake
M	source/blender/io/usd/CMakeLists.txt
M	source/creator/CMakeLists.txt

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

diff --git a/build_files/build_environment/cmake/openimageio.cmake b/build_files/build_environment/cmake/openimageio.cmake
index e8486cc4142..d48b234a60a 100644
--- a/build_files/build_environment/cmake/openimageio.cmake
+++ b/build_files/build_environment/cmake/openimageio.cmake
@@ -115,6 +115,8 @@ add_dependencies(
   external_boost
   external_tiff
   external_pugixml
+  external_fmt
+  external_robinmap
   external_openjpeg${OPENJPEG_POSTFIX}
   ${WEBP_DEP}
 )
diff --git a/build_files/build_environment/cmake/usd.cmake b/build_files/build_environment/cmake/usd.cmake
index adccbe60ea6..8bffc402cc4 100644
--- a/build_files/build_environment/cmake/usd.cmake
+++ b/build_files/build_environment/cmake/usd.cmake
@@ -1,45 +1,59 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
-if(WIN32)
-  set(USD_PLATFORM_ARGS
-    -DBUILD_SHARED_LIBS=On
-    -DTBB_ROOT_DIR=${LIBDIR}/tbb/
-  )
-else()
-  set(USD_PLATFORM_ARGS
-    -DBUILD_SHARED_LIBS=Off
-    # USD is hellbound on making a shared lib, unless you point this variable to a valid cmake file
-    # doesn't have to make sense, but as long as it points somewhere valid it will skip the shared lib.
-    -DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
-    -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-    -DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-    # USD wants the tbb debug lib set even when you are doing a release build
-    # Otherwise it will error out during the cmake configure phase.
-    -DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
+if(WIN32 AND BUILD_MODE STREQUAL Debug)
+  # There is something wonky in the ctor of the USD Trace class
+  # It will gobble up all ram and derefs a nullptr once it runs
+  # out...so...thats fun... I lack the time to debug this currently
+  # so disabling the trace will have to suffice.
+  set(USD_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DTRACE_DISABLE")
+  # USD does not look for debug libs, nor does it link them
+  # when building static, so this is just to keep find_package happy
+  # if we ever link dynamically on windows util will need to be linked.
+  set(USD_PLATFORM_FLAGS
+    -DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}
+    -DCMAKE_CXX_FLAGS=${USD_CXX_FLAGS}
   )
 endif()
 
 set(USD_EXTRA_ARGS
   ${DEFAULT_BOOST_FLAGS}
-  -DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
-
+  ${USD_PLATFORM_FLAGS}
   # This is a preventative measure that avoids possible conflicts when add-ons
   # try to load another USD library into the same process space.
   -DPXR_SET_INTERNAL_NAMESPACE=usdBlender
-
+  -DOPENSUBDIV_ROOT_DIR=${LIBDIR}/opensubdiv
+  -DOpenImageIO_ROOT=${LIBDIR}/openimageio
+  -DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
+  -DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
+  -DOSL_ROOT=${LIBDIR}/osl
   -DPXR_ENABLE_PYTHON_SUPPORT=OFF
-  -DPXR_BUILD_IMAGING=OFF
+  -DPXR_BUILD_IMAGING=ON
   -DPXR_BUILD_TESTS=OFF
   -DPXR_BUILD_EXAMPLES=OFF
+  -DPXR_BUILD_TUTORIALS=OFF
+  -DPXR_ENABLE_HDF5_SUPPORT=OFF
+  -DPXR_ENABLE_MATERIALX_SUPPORT=OFF
+  -DPXR_ENABLE_OPENVDB_SUPPORT=OFF
   -DPYTHON_EXECUTABLE=${PYTHON_BINARY}
   -DPXR_BUILD_MONOLITHIC=ON
-
-  # The PXR_BUILD_USD_TOOLS argument is patched-in by usd.diff. An upstream pull request
-  # can be found at https://github.com/PixarAnimationStudios/USD/pull/1048.
+  -DPXR_ENABLE_OSL_SUPPORT=ON
+  -DPXR_BUILD_OPENIMAGEIO_PLUGIN=ON
+  # USD 22.03 does not support OCIO 2.x
+  # Tracking ticket https://github.com/PixarAnimationStudios/USD/issues/1386
+  -DPXR_BUILD_OPENCOLORIO_PLUGIN=OFF
+  -DPXR_ENABLE_PTEX_SUPPORT=OFF
   -DPXR_BUILD_USD_TOOLS=OFF
-
   -DCMAKE_DEBUG_POSTFIX=_d
-  ${USD_PLATFORM_ARGS}
+  -DBUILD_SHARED_LIBS=Off
+  # USD is hellbound on making a shared lib, unless you point this variable to a valid cmake file
+  # doesn't have to make sense, but as long as it points somewhere valid it will skip the shared lib.
+  -DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
+  -DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
+  -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
+  -DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
+  # USD wants the tbb debug lib set even when you are doing a release build
+  # Otherwise it will error out during the cmake configure phase.
+  -DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
 )
 
 ExternalProject_Add(external_usd
@@ -66,22 +80,24 @@ if(WIN32)
   # on windows.
   add_dependencies(
     external_usd
-    external_python
+    external_openimageio
+    external_opensubdiv
+    external_osl
   )
   if(BUILD_MODE STREQUAL Release)
     ExternalProject_Add_Step(external_usd after_install
       COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/include ${HARVEST_TARGET}/usd/include
       COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/plugin ${HARVEST_TARGET}/usd/plugin
       COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib/usd ${HARVEST_TARGET}/usd/lib/usd
-      COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_usd_ms.lib ${HARVEST_TARGET}/usd/lib/usd_usd_ms.lib
-      COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_usd_ms.dll ${HARVEST_TARGET}/usd/lib/usd_usd_ms.dll
+      # See comment below about the monolithic lib on linux, same applies here.
+      COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/release/usd_usd_m.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m.lib
       DEPENDEES install
     )
   endif()
   if(BUILD_MODE STREQUAL Debug)
     ExternalProject_Add_Step(external_usd after_install
-      COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_usd_ms_d.lib ${HARVEST_TARGET}/usd/lib/usd_usd_ms_d.lib
-      COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_usd_ms_d.dll ${HARVEST_TARGET}/usd/lib/usd_usd_ms_d.dll
+      # See comment below about the monolithic lib on linux, same applies here.
+      COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/debug/usd_usd_m_d.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m_d.lib
       DEPENDEES install
     )
   endif()
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 3c1bac0c6ce..beadbf353be 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -810,8 +810,8 @@ if(WITH_USD)
   if(NOT USD_FOUND)
     set(USD_FOUND ON)
     set(USD_INCLUDE_DIRS ${LIBDIR}/usd/include)
-    set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_usd_ms.lib)
-    set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_usd_ms_d.lib)
+    set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_usd_m.lib)
+    set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_usd_m_d.lib)
     set(USD_LIBRARY_DIR ${LIBDIR}/usd/lib)
     # Older USD had different filenames, if the new ones are
     # not found see if the older ones exist, to ease the
diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt
index 282df68daa7..531d543d9a3 100644
--- a/source/blender/io/usd/CMakeLists.txt
+++ b/source/blender/io/usd/CMakeLists.txt
@@ -10,17 +10,10 @@ if(UNIX AND NOT APPLE)
 endif()
 if(WIN32)
   add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
-  # The existance of this header really doesn't influence wither USD is
-  # a static or dynamic lib, however, when this header got introduced
-  # we switched from static -> dynamic. To ease the trasition period
-  # deal with both options.
-  if (NOT EXISTS "${USD_INCLUDE_DIRS}/pxr/usd/usdLux/boundableLightBase.h")
-    add_definitions(-DPXR_STATIC)
-  endif()
-else()
-  add_definitions(-DPXR_STATIC)
 endif()
 
+add_definitions(-DPXR_STATIC)
+
 # USD headers use deprecated TBB headers, silence warning.
 add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
 
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index ce0e622ba2b..d17afad0918 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -792,19 +792,6 @@ elseif(WIN32)
       )
   endif()
 
-  if(WITH_USD)
-      install(
-        FILES ${LIBDIR}/usd/lib/usd_usd_ms.dll
-        DESTINATION "."
-        CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
-      )
-      install(
-        FILES ${LIBDIR}/usd/lib/usd_usd_ms_d.dll
-        DESTINATION "."
-        CONFIGURATIONS Debug
-      )
-  endif()
-
   if(WITH_PYTHON)
     string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})



More information about the Bf-blender-cvs mailing list