[Bf-blender-cvs] [c80f3f0d173] tmp-vfx-platform-2023: Fix USD/OpenColorIO build issues on macOS

Brecht Van Lommel noreply at git.blender.org
Mon Nov 7 23:30:34 CET 2022


Commit: c80f3f0d1731c00b1205c5c95cb066cd420278c8
Author: Brecht Van Lommel
Date:   Mon Nov 7 23:07:43 2022 +0100
Branches: tmp-vfx-platform-2023
https://developer.blender.org/rBc80f3f0d1731c00b1205c5c95cb066cd420278c8

Fix USD/OpenColorIO build issues on macOS

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

M	build_files/build_environment/cmake/harvest.cmake
M	build_files/build_environment/cmake/minizipng.cmake
M	build_files/build_environment/cmake/usd.cmake
M	build_files/cmake/Modules/FindOpenColorIO.cmake

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

diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index 6616c675e9b..fc8845405dd 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -181,6 +181,7 @@ harvest(opencollada/lib/opencollada opencollada/lib "*.a")
 harvest(opencolorio/include opencolorio/include "*.h")
 harvest(opencolorio/lib opencolorio/lib "*.a")
 harvest(opencolorio/lib/static opencolorio/lib "*.a")
+harvest(minizipng/lib opencolorio/lib "*.a")
 harvest(openexr/include openexr/include "*.h")
 harvest_rpath_lib(openexr/lib openexr/lib "*${SHAREDLIBEXT}*")
 harvest_rpath_bin(openimageio/bin openimageio/bin "idiff")
@@ -236,7 +237,7 @@ harvest(aom/lib ffmpeg/lib "*.a")
 harvest(webp/lib webp/lib "*.a")
 harvest(webp/include webp/include "*.h")
 harvest(usd/include usd/include "*.h")
-harvest_rpath_lib(usd/lib usd/lib "libusd_usd_ms${SHAREDLIBEXT}")
+harvest_rpath_lib(usd/lib usd/lib "libusd_ms${SHAREDLIBEXT}")
 harvest(usd/lib/usd usd/lib/usd "*")
 harvest_rpath_python(usd/lib/python/pxr python/lib/python${PYTHON_SHORT_VERSION}/site-packages/pxr "*")
 harvest(usd/plugin usd/plugin "*")
diff --git a/build_files/build_environment/cmake/minizipng.cmake b/build_files/build_environment/cmake/minizipng.cmake
index e59b4c8826d..f9bc7a4875f 100644
--- a/build_files/build_environment/cmake/minizipng.cmake
+++ b/build_files/build_environment/cmake/minizipng.cmake
@@ -3,8 +3,16 @@
 set(MINIZIPNG_EXTRA_ARGS
   -DMZ_FETCH_LIBS=OFF
   -DMZ_LIBCOMP=OFF
+  -DMZ_PKCRYPT=OFF
+  -DMZ_WZAES=OFF
+  -DMZ_OPENSSL=OFF
+  -DMZ_SIGNING=OFF
+  -DMZ_LZMA=OFF
+  -DMZ_ZSTD=OFF
   -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
   -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
+  -DBZIP2_LIBRARY=${LIBDIR}/bzip2/lib/${LIBPREFIX}bz2${LIBEXT}
+  -DBZIP2_INCLUDE_DIR=${LIBDIR}/bzip2/include/
   # Because OCIO hardcodes a non standard include path
   -DCMAKE_INSTALL_INCLUDEDIR=${LIBDIR}/minizipng/include/minizip-ng
 )
diff --git a/build_files/build_environment/cmake/usd.cmake b/build_files/build_environment/cmake/usd.cmake
index 4abb368e740..64d64e82110 100644
--- a/build_files/build_environment/cmake/usd.cmake
+++ b/build_files/build_environment/cmake/usd.cmake
@@ -26,11 +26,16 @@ elseif(UNIX)
   # Workaround USD not linking correctly with static Python library, where it would embed
   # part of the interpret in the USD library. Allow undefined Python symbols and replace
   # Python library with TBB so it doesn't complain about missing library.
-  set(USD_SHARED_LINKER_FLAGS "-Xlinker -undefined -Xlinker dynamic_lookup")
   set(USD_PLATFORM_FLAGS
     -DPYTHON_INCLUDE_DIR=${LIBDIR}/python/include/python${PYTHON_SHORT_VERSION}/
     -DPYTHON_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
    )
+
+  if(APPLE)
+    set(USD_SHARED_LINKER_FLAGS "-Xlinker -undefined -Xlinker dynamic_lookup")
+    list(APPEND USD_PLATFORM_FLAGS
+      -DCMAKE_SHARED_LINKER_FLAGS=${USD_SHARED_LINKER_FLAGS})
+  endif()
 endif()
 
 set(USD_EXTRA_ARGS
@@ -40,6 +45,7 @@ set(USD_EXTRA_ARGS
   -DOpenImageIO_ROOT=${LIBDIR}/openimageio
   -DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
   -DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
+  -DImath_DIR=${LIBDIR}/imath
   -DOPENVDB_LOCATION=${LIBDIR}/openvdb
   -DPXR_ENABLE_PYTHON_SUPPORT=ON
   -DPXR_USE_PYTHON_3=ON
@@ -127,15 +133,4 @@ if(WIN32)
       DEPENDEES install
     )
   endif()
-else()
-  # USD has two build options. The default build creates lots of small libraries,
-  # whereas the 'monolithic' build produces only a single library. The latter
-  # makes linking simpler, so that's what we use in Blender. However, running
-  # 'make install' in the USD sources doesn't install the static library in that
-  # case (only the shared library). As a result, we need to grab the `libusd_m.a`
-  # file from the build directory instead of from the install directory.
-  ExternalProject_Add_Step(external_usd after_install
-    COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/lib${PXR_LIB_PREFIX}usd_m.a ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m.a
-    DEPENDEES install
-  )
 endif()
diff --git a/build_files/cmake/Modules/FindOpenColorIO.cmake b/build_files/cmake/Modules/FindOpenColorIO.cmake
index 8e152008ea7..01f808d947c 100644
--- a/build_files/cmake/Modules/FindOpenColorIO.cmake
+++ b/build_files/cmake/Modules/FindOpenColorIO.cmake
@@ -24,6 +24,7 @@ SET(_opencolorio_FIND_COMPONENTS
   yaml-cpp
   expat
   pystring
+  minizip
 )
 
 SET(_opencolorio_SEARCH_DIRS



More information about the Bf-blender-cvs mailing list