[Bf-blender-cvs] [4c48a1f7c73] tmp-vfx-platform-2023: deps_builder: Add materialX 1.38.6

Georgiy Markelov noreply at git.blender.org
Mon Nov 21 19:08:04 CET 2022


Commit: 4c48a1f7c7357826173cc3eeef02b879f413049f
Author: Georgiy Markelov
Date:   Mon Nov 21 11:07:55 2022 -0700
Branches: tmp-vfx-platform-2023
https://developer.blender.org/rB4c48a1f7c7357826173cc3eeef02b879f413049f

deps_builder: Add materialX 1.38.6

This adds materialX to the deps builder, short term only the python
bindings are expected to be used, but libraries are included for
future use by blender as well. Some further work may need to be done
in having MaterialX find its library.

Reviewed by: brecht lazydodo
Differential Revision: https://developer.blender.org/D15989

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

M	CMakeLists.txt
M	build_files/build_environment/CMakeLists.txt
M	build_files/build_environment/cmake/download.cmake
M	build_files/build_environment/cmake/harvest.cmake
M	build_files/build_environment/cmake/versions.cmake
M	build_files/cmake/config/blender_full.cmake
M	build_files/cmake/config/blender_lite.cmake
M	build_files/cmake/config/blender_release.cmake
M	build_files/cmake/platform/platform_unix.cmake
R065	release/windows/python/usercustomize.py	release/scripts/site/usercustomize.py
M	source/creator/CMakeLists.txt

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a621b859e7..1e80e0ffcdd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -330,6 +330,9 @@ option(WITH_ALEMBIC             "Enable Alembic Support" ON)
 # Universal Scene Description support
 option(WITH_USD                 "Enable Universal Scene Description (USD) Support" ON)
 
+# MaterialX
+option(WITH_MATERIALX           "Enable MaterialX Support" ON)
+
 # 3D format support
 # Disable opencollada when we don't have precompiled libs
 option(WITH_OPENCOLLADA   "Enable OpenCollada Support (http://www.opencollada.org)" ON)
@@ -1921,6 +1924,7 @@ if(FIRST_RUN)
   info_cfg_option(WITH_QUADRIFLOW)
   info_cfg_option(WITH_TBB)
   info_cfg_option(WITH_USD)
+  info_cfg_option(WITH_MATERIALX)
   info_cfg_option(WITH_XR_OPENXR)
 
   info_cfg_text("Compiler Options:")
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt
index 75591333c12..0e3df021a25 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -88,6 +88,7 @@ endif()
 include(cmake/python_site_packages.cmake)
 include(cmake/package_python.cmake)
 include(cmake/usd.cmake)
+include(cmake/materialx.cmake)
 include(cmake/openvdb.cmake)
 include(cmake/potrace.cmake)
 include(cmake/haru.cmake)
diff --git a/build_files/build_environment/cmake/download.cmake b/build_files/build_environment/cmake/download.cmake
index f2681bd33d6..292cc994a44 100644
--- a/build_files/build_environment/cmake/download.cmake
+++ b/build_files/build_environment/cmake/download.cmake
@@ -126,6 +126,7 @@ download_source(SSL)
 download_source(SQLITE)
 download_source(EMBREE)
 download_source(USD)
+download_source(MATERIALX)
 download_source(OIDN)
 download_source(LIBGLU)
 download_source(MESA)
diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index fc8845405dd..8b2a3a77ca7 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -241,6 +241,16 @@ 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 "*")
+harvest(materialx/include materialx/include "*.h")
+harvest(materialx/lib materialx/lib "*")
+harvest(materialx/libraries materialx/libraries "*")
+harvest(materialx/python materialx/python "*")
+harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake")
+harvest_rpath_python(materialx/python/MaterialX python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX "*")
+# We do not need anything from the resources folder, but the MaterialX config
+# file will complain if the folder does not exist, so just copy the readme.md
+# files to ensure the folder will exist.
+harvest(materialx/resources materialx/resources "README.md")
 harvest(potrace/include potrace/include "*.h")
 harvest(potrace/lib potrace/lib "*.a")
 harvest(haru/include haru/include "*.h")
diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake
index c57e9da55e0..46ff62a79df 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -473,6 +473,12 @@ set(USD_HASH 8c89459e48a2ef0e7ae9e7e490377507)
 set(USD_HASH_TYPE MD5)
 set(USD_FILE usd-v${USD_VERSION}.tar.gz)
 
+set(MATERIALX_VERSION 1.38.6)
+set(MATERIALX_URI https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v${MATERIALX_VERSION}.tar.gz)
+set(MATERIALX_HASH d49c9fdef34b5702fc60058d3e1864f2)
+set(MATERIALX_HASH_TYPE MD5)
+set(MATERIALX_FILE materialx-v${MATERIALX_VERSION}.tar.gz)
+
 set(OIDN_VERSION 1.4.3)
 set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
 set(OIDN_HASH 027093eaf5e8b4e45835b991137b38e6)
diff --git a/build_files/cmake/config/blender_full.cmake b/build_files/cmake/config/blender_full.cmake
index 95304bd64c7..4602962d1cd 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -58,6 +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           ON  CACHE BOOL "" FORCE)
 
 set(WITH_MEM_JEMALLOC        ON  CACHE BOOL "" FORCE)
 
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index 38997e2139b..79a0e5f3858 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -63,6 +63,7 @@ set(WITH_QUADRIFLOW          OFF CACHE BOOL "" FORCE)
 set(WITH_SDL                 OFF CACHE BOOL "" FORCE)
 set(WITH_TBB                 OFF CACHE BOOL "" FORCE)
 set(WITH_USD                 OFF CACHE BOOL "" FORCE)
+set(WITH_MATERIALX           OFF CACHE BOOL "" FORCE)
 set(WITH_WASAPI              OFF CACHE BOOL "" FORCE)
 set(WITH_XR_OPENXR           OFF CACHE BOOL "" FORCE)
 
diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake
index 74bbcb223c3..dc2fad3ad2d 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -59,6 +59,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           ON  CACHE BOOL "" FORCE)
 
 set(WITH_MEM_JEMALLOC          ON  CACHE BOOL "" FORCE)
 
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 49b7f701de0..8184b1cc0c0 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -68,6 +68,7 @@ if(EXISTS ${LIBDIR})
   set(Boost_NO_SYSTEM_PATHS ON)
   set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
   set(CLANG_ROOT_DIR ${LIBDIR}/llvm)
+  set(MaterialX_DIR ${LIBDIR}/materialx/lib/cmake/MaterialX)
 endif()
 
 # Wrapper to prefer static libraries
@@ -353,6 +354,14 @@ if(WITH_USD)
  endif()
 endif()
 
+if(WITH_MATERIALX)
+  find_package_wrapper(MaterialX)
+  set_and_warn_library_found("MaterialX" MaterialX_FOUND WITH_MATERIALX)
+  if(WITH_MATERIALX)
+    add_bundled_libraries(materialx/lib)
+  endif()
+endif()
+
 if(WITH_BOOST)
   # uses in build instructions to override include and library variables
   if(NOT BOOST_CUSTOM)
diff --git a/release/windows/python/usercustomize.py b/release/scripts/site/usercustomize.py
similarity index 65%
rename from release/windows/python/usercustomize.py
rename to release/scripts/site/usercustomize.py
index 8d752581183..8c2e37ee790 100644
--- a/release/windows/python/usercustomize.py
+++ b/release/scripts/site/usercustomize.py
@@ -12,3 +12,8 @@ if sys.platform == 'win32':
         import_paths = os.getenv('PXR_USD_WINDOWS_DLL_PATH')
         if import_paths is None:
             os.environ["PXR_USD_WINDOWS_DLL_PATH"] = blender_dir
+
+        materialx_libs_dir = os.path.abspath(os.path.join(exe_dir, '..', '..', 'datafiles', 'materialx', 'libraries'))
+        materialx_libs_env = os.getenv('MATERIALX_SEARCH_PATH')
+        if materialx_libs_env is None:
+            os.environ["MATERIALX_SEARCH_PATH"] = materialx_libs_dir
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index b836046d29d..cd70e8639db 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -413,14 +413,20 @@ if(WITH_PYTHON)
     PATTERN ".github" EXCLUDE
     PATTERN ".arcconfig" EXCLUDE
     PATTERN "__pycache__" EXCLUDE
+    PATTERN "site" EXCLUDE
     PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
     PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE
   )
   if(WIN32)
     install(
-      FILES ${CMAKE_SOURCE_DIR}/release/windows/python/usercustomize.py
+      FILES ${CMAKE_SOURCE_DIR}/release/scripts/site/usercustomize.py
       DESTINATION ${TARGETDIR_VER}/python/lib/site-packages
     )
+  else()
+    install(
+      FILES ${CMAKE_SOURCE_DIR}/release/scripts/site/usercustomize.py
+      DESTINATION ${TARGETDIR_VER}/python/lib/python${PYTHON_VERSION}/site-packages
+    )
   endif()
   unset(ADDON_EXCLUDE_CONDITIONAL)
   unset(FREESTYLE_EXCLUDE_CONDITIONAL)
@@ -969,6 +975,37 @@ elseif(WIN32)
       endif()
   endif()
 
+  if(WITH_MATERIALX)
+    windows_install_shared_manifest(
+      FILES
+        ${LIBDIR}/materialx/bin/MaterialXCore.dll
+        ${LIBDIR}/materialx/bin/MaterialXFormat.dll
+        ${LIBDIR}/materialx/bin/MaterialXGenGlsl.dll
+        ${LIBDIR}/materialx/bin/MaterialXGenMdl.dll
+        ${LIBDIR}/materialx/bin/MaterialXGenOsl.dll
+        ${LIBDIR}/materialx/bin/MaterialXGenShader.dll
+        ${LIBDIR}/materialx/bin/MaterialXRenderGlsl.dll
+        ${LIBDIR}/materialx/bin/MaterialXRenderHw.dll
+        ${LIBDIR}/materialx/bin/MaterialXRenderOsl.dll
+        ${LIBDIR}/materialx/bin/MaterialXRender.dll
+      RELEASE
+    )
+    windows_install_shared_manifest(
+      FILES
+        ${LIBDIR}/materialx/bin/MaterialXCore_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXFormat_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXGenGlsl_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXGenMdl_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXGenOsl_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXGenShader_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXRenderGlsl_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXRenderHw_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXRenderOsl_d.dll
+        ${LIBDIR}/materialx/bin/MaterialXRender_d.dll
+      DEBUG
+    )
+  endif()
+
   if(WITH_PYTHON)
     string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
 
@@ -1077,6 +1114,29 @@ elseif(WIN32)
         endif()
       endif()
 
+      if(WITH_MATERIALX)
+        # MaterialX python bindings
+
+        install(
+            DIRECTORY ${LIBDIR}/materialx/python/Release/MaterialX


@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list