Build: install USD Storm and MaterialX libraries by default

* Bundle hdStorm and associated plugins
* Enable WITH_MATERIALX by default to bundle MaterialX libraries
* Set PXR_MTLX_STDLIB_SEARCH_PATHS so Storm can find MaterialX files

Co-authored-by: Georgiy Markelov <georgiy.m.markelov@gmail.com>
Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Ref #110765, #104712
This commit is contained in:
Bogdan Nagirniak 2023-08-04 14:54:49 +02:00 committed by Brecht Van Lommel
parent efe10cee5c
commit 61f407d427
6 changed files with 30 additions and 6 deletions

View File

@ -365,7 +365,7 @@ option(WITH_ALEMBIC "Enable Alembic Support" ON)
option(WITH_USD "Enable Universal Scene Description (USD) Support" ON)
# MaterialX
option(WITH_MATERIALX "Enable MaterialX Support" OFF)
option(WITH_MATERIALX "Enable MaterialX Support" ON)
# 3D format support
# Disable opencollada when we don't have precompiled libs

View File

@ -57,7 +57,7 @@ set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)
set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_TBB ON CACHE BOOL "" FORCE)
set(WITH_USD ON CACHE BOOL "" FORCE)
set(WITH_MATERIALX OFF CACHE BOOL "" FORCE)
set(WITH_MATERIALX ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)

View File

@ -58,7 +58,7 @@ set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)
set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_TBB ON CACHE BOOL "" FORCE)
set(WITH_USD ON CACHE BOOL "" FORCE)
set(WITH_MATERIALX OFF CACHE BOOL "" FORCE)
set(WITH_MATERIALX ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)

View File

@ -965,6 +965,10 @@ if(WITH_USD)
endif()
endif()
if(WITH_MATERIALX)
include("${LIBDIR}/MaterialX/lib/cmake/MaterialX/MaterialXTargets.cmake")
endif()
if(WINDOWS_PYTHON_DEBUG)
# Include the system scripts in the blender_python_system_scripts project.
file(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/scripts/*.*" )

View File

@ -38,7 +38,11 @@ materialx_libs_dir = os.path.abspath(os.path.join(shared_lib_dir, "materialx", "
materialx_libs_env = os.getenv("MATERIALX_SEARCH_PATH")
if materialx_libs_env is None:
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir
elif sys.platform == "win32":
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir + ";" + materialx_libs_env
else:
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir + ":" + materialx_libs_env
os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_env + os.pathsep + materialx_libs_dir
materialx_libs_env = os.getenv("PXR_MTLX_STDLIB_SEARCH_PATHS")
if materialx_libs_env is None:
os.environ["PXR_MTLX_STDLIB_SEARCH_PATHS"] = materialx_libs_dir
else:
os.environ["PXR_MTLX_STDLIB_SEARCH_PATHS"] = materialx_libs_env + os.pathsep + materialx_libs_dir

View File

@ -1623,16 +1623,32 @@ if((DEFINED LIBDIR) AND TARGETDIR_LIB)
${USD_LIBRARY_DIR}/usd
DESTINATION ${TARGETDIR_LIB}
)
install(DIRECTORY
${LIBDIR}/usd/plugin/usd/hdStorm
${LIBDIR}/usd/plugin/usd/usdShaders
${LIBDIR}/usd/plugin/usd/hioOiio
DESTINATION "./blender.shared/usd"
)
elseif(USD_PYTHON_SUPPORT)
install(DIRECTORY
${USD_LIBRARY_DIR}/usd
DESTINATION ${TARGETDIR_LIB}
)
install(DIRECTORY
${LIBDIR}/usd/plugin/usd/hdStorm
${LIBDIR}/usd/plugin/usd/usdShaders
DESTINATION ${TARGETDIR_LIB}/usd
)
else()
install(DIRECTORY
${USD_LIBRARY_DIR}/usd
DESTINATION "${TARGETDIR_VER}/datafiles"
)
install(DIRECTORY
${LIBDIR}/usd/plugin/usd/hdStorm
${LIBDIR}/usd/plugin/usd/usdShaders
DESTINATION "${TARGETDIR_VER}/datafiles/usd"
)
endif()
endif()
if(WIN32)