[Bf-blender-cvs] [a318f3b8d68] master: install_deps: Add py binding for OCIO, OIIO, OpenVDB and USD.

Bastien Montagne noreply at git.blender.org
Thu Jan 5 14:14:05 CET 2023


Commit: a318f3b8d6873ddce8e40e554aae886172f5a3c7
Author: Bastien Montagne
Date:   Thu Jan 5 14:07:00 2023 +0100
Branches: master
https://developer.blender.org/rBa318f3b8d6873ddce8e40e554aae886172f5a3c7

install_deps: Add py binding for OCIO, OIIO, OpenVDB and USD.

This was quite a fight, some resulting notes:
* We cannot use anymore Boost packages because of a weird bug breaking
  Blender debug builds and ivolving Boost, TBB and USD (see also
  rB019b930d6b9c).
* OCIO, OIIO, OpenVDB and USD build options where updated to match these
  from cmake libs building.
** Most notably, USD now has imaging, OIIO, OpenVDB and GL support.

Ref. T99618.

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

M	build_files/build_environment/install_deps.sh

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

diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 81e9b0f371c..72ae675273c 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -402,6 +402,7 @@ PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_SHORT
 PYTHON_FORCE_BUILD=false
 PYTHON_FORCE_REBUILD=false
 PYTHON_SKIP=false
+_with_built_python=false
 
 # Additional Python modules.
 PYTHON_IDNA_VERSION="3.3"
@@ -466,7 +467,9 @@ BOOST_VERSION="1.80.0"
 BOOST_VERSION_SHORT="1.80"
 BOOST_VERSION_MIN="1.49"
 BOOST_VERSION_MEX="2.0"
-BOOST_FORCE_BUILD=false
+# XXX Boost currently has an issue with python/tbb, see rB019b930 for details and patch used to fix it.
+# So for now it has to be built, system packages are not usable. :(
+BOOST_FORCE_BUILD=true
 BOOST_FORCE_REBUILD=false
 BOOST_SKIP=false
 
@@ -1108,7 +1111,9 @@ PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHO
 
 _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
 BOOST_SOURCE=( "https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
-BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options --with-serialization --with-atomic"
+BOOST_BUILD_MODULES="--with-filesystem --with-locale --with-thread --with-regex --with-system --with-date_time --with-wave --with-atomic --with-serialization --with-program_options --with-iostreams --with-python"
+# Used by debian distros.
+BOOST_DEB_PACKAGE_MODULES=( "libboost-filesystem" "libboost-locale" "libboost-thread" "libboost-regex" "libboost-system" "libboost-date-time" "libboost-wave" "libboost-atomic" "libboost-serialization" "libboost-program-options" "libboost-iostreams" "libboost-python" "libboost-numpy" )
 
 TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" )
 TBB_SOURCE_CMAKE=( "https://raw.githubusercontent.com/wjakob/tbb/master/CMakeLists.txt" )
@@ -1217,7 +1222,7 @@ Those libraries should be available as packages in all recent distributions (opt
     * libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
     * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
     * libwayland-client0, libdecor, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
-    * libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex.
+    * libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex, pybind11.
     * libsdl2, libepoxy, libpugixml, libpotrace, [libgmp], fontconfig, [libharu/libhpdf].\""
 
 DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -1479,9 +1484,17 @@ _init_python() {
 _update_deps_python() {
   if [ "$1" = true ]; then
     BOOST_FORCE_BUILD=true
+    OCIO_FORCE_BUILD=true
+    OIIO_FORCE_BUILD=true
+    OPENVDB_FORCE_BUILD=true
+    USD_FORCE_BUILD=true
   fi
   if [ "$2" = true ]; then
     BOOST_FORCE_REBUILD=true
+    OCIO_FORCE_REBUILD=true
+    OIIO_FORCE_REBUILD=true
+    OPENVDB_FORCE_REBUILD=true
+    USD_FORCE_REBUILD=true
   fi
 }
 
@@ -1567,6 +1580,9 @@ compile_Python() {
     PRINT ""
     $_python -m pip install $module --no-binary :all:
   done
+
+  _with_built_python=true
+  _with_built_python_execpath="$INST/python-$PYTHON_VERSION_SHORT/bin/python3"
 }
 
 # ----------------------------------------------------------------------------
@@ -1585,12 +1601,14 @@ _update_deps_boost() {
     OSL_FORCE_BUILD=true
     OPENVDB_FORCE_BUILD=true
     ALEMBIC_FORCE_BUILD=true
+    USD_FORCE_BUILD=true
   fi
   if [ "$2" = true ]; then
     OIIO_FORCE_REBUILD=true
     OSL_FORCE_REBUILD=true
     OPENVDB_FORCE_REBUILD=true
     ALEMBIC_FORCE_REBUILD=true
+    USD_FORCE_REBUILD=true
   fi
 }
 
@@ -1610,7 +1628,7 @@ compile_Boost() {
   fi
 
   # To be changed each time we make edits that would modify the compiled result!
-  boost_magic=14
+  boost_magic=15
 
   _init_boost
 
@@ -1636,11 +1654,13 @@ compile_Boost() {
       mkdir -p $SRC
       download BOOST_SOURCE[@] $_src.tar.bz2
       tar -C $SRC --transform "s,\w*,boost-$BOOST_VERSION,x" -xf $_src.tar.bz2
+
+      patch -d $_src -p1 < $SCRIPT_DIR/patches/boost.diff
     fi
 
     cd $_src
     if [ ! -f $_src/b2 ]; then
-      if [ -d $INST/python-$PYTHON_VERSION_INSTALLED ]; then
+      if [ -d $_with_built_python ]; then
         ./bootstrap.sh --with-python-root="$INST/python-$PYTHON_VERSION_INSTALLED"
       else
         ./bootstrap.sh
@@ -1835,7 +1855,7 @@ compile_OCIO() {
   fi
 
   # To be changed each time we make edits that would modify the compiled result!
-  ocio_magic=3
+  ocio_magic=5
   _init_ocio
 
   # Force having own builds for the dependencies.
@@ -1890,9 +1910,13 @@ compile_OCIO() {
     cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
     cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
     cmake_d="$cmake_d -D OCIO_BUILD_APPS=OFF"
-    cmake_d="$cmake_d -D OCIO_BUILD_PYTHON=OFF"
+    cmake_d="$cmake_d -D OCIO_BUILD_PYTHON=ON"
     cmake_d="$cmake_d -D OCIO_BUILD_GPU_TESTS=OFF"
 
+    if [ "$_with_built_python" = true ]; then
+      cmake_d="$cmake_d -D Python_EXECUTABLE=$_with_built_python_execpath"
+    fi
+
     if [ $(uname -m) == "aarch64" ]; then
       cmake_d="$cmake_d -D OCIO_USE_SSE=OFF"
     fi
@@ -2082,11 +2106,13 @@ _update_deps_openexr() {
     OIIO_FORCE_BUILD=true
     OPENVDB_FORCE_BUILD=true
     ALEMBIC_FORCE_BUILD=true
+    USD_FORCE_BUILD=true
   fi
   if [ "$2" = true ]; then
     OIIO_FORCE_REBUILD=true
     OPENVDB_FORCE_REBUILD=true
     ALEMBIC_FORCE_REBUILD=true
+    USD_FORCE_REBUILD=true
   fi
 }
 
@@ -2215,9 +2241,11 @@ _init_oiio() {
 _update_deps_oiio() {
   if [ "$1" = true ]; then
     OSL_FORCE_BUILD=true
+    USD_FORCE_BUILD=true
   fi
   if [ "$2" = true ]; then
     OSL_FORCE_REBUILD=true
+    USD_FORCE_REBUILD=true
   fi
 }
 
@@ -2237,7 +2265,7 @@ compile_OIIO() {
   fi
 
   # To be changed each time we make edits that would modify the compiled result!
-  oiio_magic=19
+  oiio_magic=20
   _init_oiio
 
   # Force having own builds for the dependencies.
@@ -2291,6 +2319,7 @@ compile_OIIO() {
     cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
     cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
     cmake_d="$cmake_d -D LINKSTATIC=OFF"
+    cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
 
     if [ $(uname -m) != "aarch64" ]; then
       cmake_d="$cmake_d -D USE_SIMD=sse2"
@@ -2306,21 +2335,37 @@ compile_OIIO() {
       cmake_d="$cmake_d -D OpenEXR_ROOT=$INST/openexr"
     fi
 
-    # ptex is only needed when nicholas bishop is ready
-    cmake_d="$cmake_d -D USE_PTEX=OFF"
+    cmake_d="$cmake_d -D USE_PYTHON=ON"
+    if [ "$_with_built_python" = true ]; then
+      cmake_d="$cmake_d -D Python_EXECUTABLE=$_with_built_python_execpath"
+    fi
 
     # Optional tests and cmd tools
     cmake_d="$cmake_d -D USE_QT=OFF"
-    cmake_d="$cmake_d -D USE_PYTHON=OFF"
+    cmake_d="$cmake_d -D USE_QT5=OFF"
+    cmake_d="$cmake_d -D USE_OPENGL=OFF"
+    cmake_d="$cmake_d -D USE_TBB=OFF"
+    cmake_d="$cmake_d -D USE_BZIP2=OFF"
+    cmake_d="$cmake_d -D USE_FREETYPE=OFF"
+    cmake_d="$cmake_d -D USE_OPENCOLORIO=OFF"
+
+    cmake_d="$cmake_d -D USE_WEBP=ON"
+    cmake_d="$cmake_d -D USE_OPENJPEG=ON"
+
     cmake_d="$cmake_d -D USE_FFMPEG=OFF"
     cmake_d="$cmake_d -D USE_OPENCV=OFF"
     cmake_d="$cmake_d -D USE_OPENVDB=OFF"
+    cmake_d="$cmake_d -D USE_NUKE=OFF"
+    cmake_d="$cmake_d -D USE_DCMTK=OFF"
+    cmake_d="$cmake_d -D USE_LIBHEIF=OFF"
+    cmake_d="$cmake_d -D USE_GIF=OFF"
+    cmake_d="$cmake_d -D USE_LIBRAW=OFF"
+    cmake_d="$cmake_d -D USE_LIBSQUISH=OFF"
+
     cmake_d="$cmake_d -D BUILD_TESTING=OFF"
     cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
     cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=ON"
     cmake_d="$cmake_d -D TXT2MAN="
-    #cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
-    #cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
 
     if [ -d $INST/boost ]; then
       cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON -D Boost_NO_BOOST_CMAKE=ON"
@@ -2878,7 +2923,12 @@ _init_openvdb() {
 }
 
 _update_deps_openvdb() {
-  :
+  if [ "$1" = true ]; then
+    USD_FORCE_BUILD=true
+  fi
+  if [ "$2" = true ]; then
+    USD_FORCE_REBUILD=true
+  fi
 }
 
 clean_OPENVDB() {
@@ -2900,7 +2950,7 @@ compile_OPENVDB() {
   PRINT ""
 
   # To be changed each time we make edits that would modify the compiled result!
-  openvdb_magic=4
+  openvdb_magic=5
   _init_openvdb
 
   # Force having own builds for the dependencies.
@@ -2949,12 +2999,18 @@ compile_OPENVDB() {
     cmake_d="-D CMAKE_BUILD_TYPE=Release"
     cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
     cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
+    cmake_d="$cmake_d -D OPENVDB_CORE_SHARED=ON"
+    cmake_d="$cmake_d -D OPENVDB_CORE_STATIC=OFF"
     cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
 
     if [ "$WITH_NANOVDB" = true ]; then
       cmake_d="$cmake_d -D USE_NANOVDB=ON"
+      cmake_d="$cmake_d -D OPENVDB_BUILD_NANOVDB=ON"
+      cmake_d="$cmake_d -D NANOVDB_BUILD_TOOLS=OFF"
     else
       cmake_d="$cmake_d -D USE_NANOVDB=OFF"
+      cmake_d="$cmake_d -D OPENVDB_BUILD_NANOVDB=OFF"
+      cmake_d="$cmake_d -D NANOVDB_BUILD_TOOLS=OFF"
     fi
 
     if [ -d $INST/boost ]; then
@@ -2982,6 +3038,13 @@ compile_OPENVDB() {
       cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc"
     fi
 
+    cmake_d="$cmake_d -D OPENVDB_BUILD_PYTHON_MODULE=ON"
+    cmake_d="$cmake_d -D OPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON"
+    cmake_d="$cmake_d -D USE_NUMPY=ON"
+    if [ "$_with_built_python" = true ]; then
+      cmake_d="$cmake_d -D Python_EXECUTABLE=$_with_built_python_execpath"
+    fi
+
     cmake $cmake_d ..
 
     make -j$THREADS install
@@ -3147,7 +3210,7 @@ compile_USD() {
   fi
 
   # To be changed each time we make edits that would modify the compiled result!
-  usd_magic=1
+  usd_magic=2
   _init_usd
 
   # Force having own builds for the dependencies.
@@ -3181,18 +3244,46 @@ compile_USD() {
     cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst"
     # For the reasoning behind these options, please s

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list