Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'build_files/build_environment/cmake/usd.cmake')
-rw-r--r--build_files/build_environment/cmake/usd.cmake74
1 files changed, 45 insertions, 29 deletions
diff --git a/build_files/build_environment/cmake/usd.cmake b/build_files/build_environment/cmake/usd.cmake
index 34e43383637..8601bd91f25 100644
--- a/build_files/build_environment/cmake/usd.cmake
+++ b/build_files/build_environment/cmake/usd.cmake
@@ -7,32 +7,50 @@ if(WIN32)
# 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 as well.
- set(USD_OIIO_CMAKE_DEFINES "-DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}")
+ set(USD_OIIO_CMAKE_DEFINES "-DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}^^${LIBDIR}/openimageio/lib/OpenImageIO_util_d${LIBEXT}")
endif()
set(USD_PLATFORM_FLAGS
${USD_OIIO_CMAKE_DEFINES}
-DCMAKE_CXX_FLAGS=${USD_CXX_FLAGS}
+ -D_PXR_CXX_DEFINITIONS=/DBOOST_ALL_NO_LIB
+ -DCMAKE_SHARED_LINKER_FLAGS_INIT=/LIBPATH:${LIBDIR}/tbb/lib
+ -DPython_FIND_REGISTRY=NEVER
+ -DPYTHON_INCLUDE_DIRS=${LIBDIR}/python/include
+ -DPYTHON_LIBRARY=${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}${LIBEXT}
)
+ if(BUILD_MODE STREQUAL Debug)
+ list(APPEND USD_PLATFORM_FLAGS -DPXR_USE_DEBUG_PYTHON=ON)
+ list(APPEND USD_PLATFORM_FLAGS -DOPENVDB_LIBRARY=${LIBDIR}/openvdb/lib/openvdb_d.lib)
+ endif()
+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}
+ )
endif()
set(USD_EXTRA_ARGS
${DEFAULT_BOOST_FLAGS}
${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_LIBRARIES=${LIBDIR}/imath/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
- -DPXR_ENABLE_PYTHON_SUPPORT=OFF
+ -DOPENVDB_LOCATION=${LIBDIR}/openvdb
+ -DPXR_ENABLE_PYTHON_SUPPORT=ON
+ -DPXR_USE_PYTHON_3=ON
-DPXR_BUILD_IMAGING=ON
-DPXR_BUILD_TESTS=OFF
-DPXR_BUILD_EXAMPLES=OFF
-DPXR_BUILD_TUTORIALS=OFF
+ -DPXR_BUILD_USDVIEW=OFF
-DPXR_ENABLE_HDF5_SUPPORT=OFF
-DPXR_ENABLE_MATERIALX_SUPPORT=OFF
- -DPXR_ENABLE_OPENVDB_SUPPORT=OFF
+ -DPXR_ENABLE_OPENVDB_SUPPORT=ON
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DPXR_BUILD_MONOLITHIC=ON
# OSL is an optional dependency of the Imaging module. However, since that
@@ -40,40 +58,36 @@ set(USD_EXTRA_ARGS
# cube, etc.) to geometry, it's not necessary. Disabling it will make it
# simpler to build Blender; currently only Cycles uses OSL.
-DPXR_ENABLE_OSL_SUPPORT=OFF
- # GL support on Linux also links to X11 libraries. Enabling it would break
- # headless or Wayland-only builds. OpenGL support would be useful if someone
- # wants to work on a Hydra viewport in Blender; when that's actually being
- # worked on, we could patch in a new PXR_ENABLE_X11_SUPPORT option (to
- # separate OpenGL from X11) and contribute it upstream.
- -DPXR_ENABLE_GL_SUPPORT=OFF
- # Disable Metal since USD fails to build this when OpenGL is disabled.
- -DPXR_ENABLE_METAL_SUPPORT=OFF
- # OIIO is used for loading image textures in Hydra Storm / Embree renderers,
- # which we don't use.
- -DPXR_BUILD_OPENIMAGEIO_PLUGIN=OFF
+ # Enable OpenGL for Hydra support. Note that this indirectly also adds an X11
+ # dependency on Linux. This would be good to eliminate for headless and Wayland
+ # only builds, however is not worse than what Blender already links to for
+ # official releases currently.
+ -DPXR_ENABLE_GL_SUPPORT=ON
+ # OIIO is used for loading image textures in Hydra Storm / Embree renderers.
+ -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
- -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
+ -DBUILD_SHARED_LIBS=ON
-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}
+ -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
+ -DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
+ -DTBB_tbb_LIBRARY_RELEASE=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
# 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}
+ -DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
)
ExternalProject_Add(external_usd
URL file://${PACKAGE_DIR}/${USD_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${USD_HASH_TYPE}=${USD_HASH}
+ CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/usd
+ LIST_SEPARATOR ^^
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/usd -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${USD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/usd
@@ -84,6 +98,8 @@ add_dependencies(
external_tbb
external_boost
external_opensubdiv
+ external_python
+ openvdb
)
# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
@@ -99,15 +115,15 @@ endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_usd after_install
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/ ${HARVEST_TARGET}/usd
- 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
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd ${HARVEST_TARGET}/usd
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_usd after_install
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib ${HARVEST_TARGET}/usd/lib
- 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
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib/python ${HARVEST_TARGET}/usd/lib/debug/python
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_usd_ms_d.dll ${HARVEST_TARGET}/usd/lib/usd_usd_ms_d.dll
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/usd/lib/usd_usd_ms_d.lib ${HARVEST_TARGET}/usd/lib/usd_usd_ms_d.lib
DEPENDEES install
)
endif()