[Bf-blender-cvs] [7fa0080c4ff] master: Install_deps: Add building of OpenPGL.

Bastien Montagne noreply at git.blender.org
Wed Oct 5 12:08:10 CEST 2022


Commit: 7fa0080c4ffa6bda6330ca2a93fde2994df5ef66
Author: Bastien Montagne
Date:   Wed Oct 5 12:06:19 2022 +0200
Branches: master
https://developer.blender.org/rB7fa0080c4ffa6bda6330ca2a93fde2994df5ef66

Install_deps: Add building of OpenPGL.

Ref. T101403.

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

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 814834ccf34..78f093d7bc6 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -40,15 +40,15 @@ ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,ver-
 force-all,force-python,force-boost,force-tbb,\
 force-ocio,force-imath,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
 force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-usd,\
-force-xr-openxr,force-level-zero,\
+force-xr-openxr,force-level-zero, force-openpgl,\
 build-all,build-python,build-boost,build-tbb,\
 build-ocio,build-imath,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
 build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\
-build-xr-openxr,build-level-zero,\
+build-xr-openxr,build-level-zero, build-openpgl,\
 skip-python,skip-boost,skip-tbb,\
 skip-ocio,skip-imath,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
 skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\
-skip-xr-openxr,skip-level-zero \
+skip-xr-openxr,skip-level-zero, skip-openpgl \
 -- "$@" \
 )
 
@@ -232,6 +232,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --build-level-zero=<ver>
         Force the build of OneAPI Level Zero library.
 
+    --build-openpgl
+        Force the build of OpenPGL library.
+
     Note about the --build-foo options:
         * They force the script to prefer building dependencies rather than using available packages.
           This may make things simpler and allow working around some distribution bugs, but on the other hand it will
@@ -302,6 +305,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --force-level-zero=<ver>
         Force the rebuild of OneAPI Level Zero library.
 
+    --force-openpgl
+        Force the rebuild of OpenPGL library.
+
     Note about the --force-foo options:
         * They obviously only have an effect if those libraries are built by this script
           (i.e. if there is no available and satisfactory package)!
@@ -363,7 +369,10 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
         Unconditionally skip OpenXR-SDK installation/building.
 
     --skip-level-zero=<ver>
-        Unconditionally skip OneAPI Level Zero installation/building.\""
+        Unconditionally skip OneAPI Level Zero installation/building.
+
+    --skip-openpgl
+        Unconditionally skip OpenPGL installation/building.\""
 
 # ----------------------------------------------------------------------------
 # Main Vars
@@ -593,6 +602,14 @@ LEVEL_ZERO_FORCE_BUILD=false
 LEVEL_ZERO_FORCE_REBUILD=false
 LEVEL_ZERO_SKIP=false
 
+OPENPGL_VERSION="0.3.1"
+OPENPGL_VERSION_SHORT="0.3"
+OPENPGL_VERSION_MIN="0.3.1"
+OPENPGL_VERSION_MEX="0.3.2"
+OPENPGL_FORCE_BUILD=false
+OPENPGL_FORCE_REBUILD=false
+OPENPGL_SKIP=false
+
 XR_OPENXR_VERSION="1.0.22"
 XR_OPENXR_VERSION_SHORT="1.0"
 XR_OPENXR_VERSION_MIN="1.0.8"
@@ -827,6 +844,7 @@ while true; do
       USD_FORCE_BUILD=true
       XR_OPENXR_FORCE_BUILD=true
       LEVEL_ZERO_FORCE_BUILD=true
+      OPENPGL_FORCE_BUILD=true
       shift; continue
     ;;
     --build-python)
@@ -887,6 +905,9 @@ while true; do
     --build-level-zero)
       LEVEL_ZERO_FORCE_BUILD=true; shift; continue
     ;;
+    --build-openpgl)
+      OPENPGL_FORCE_BUILD=true; shift; continue
+    ;;
     --force-all)
       PYTHON_FORCE_REBUILD=true
       BOOST_FORCE_REBUILD=true
@@ -907,6 +928,7 @@ while true; do
       USD_FORCE_REBUILD=true
       XR_OPENXR_FORCE_REBUILD=true
       LEVEL_ZERO_FORCE_REBUILD=true
+      OPENPGL_FORCE_REBUILD=true
       shift; continue
     ;;
     --force-python)
@@ -967,6 +989,9 @@ while true; do
     --force-level-zero)
       LEVEL_ZERO_FORCE_REBUILD=true; shift; continue
     ;;
+    --force-openpgl)
+      OPENPGL_FORCE_REBUILD=true; shift; continue
+    ;;
     --skip-python)
       PYTHON_SKIP=true; shift; continue
     ;;
@@ -1024,6 +1049,9 @@ while true; do
     --skip-level-zero)
       LEVEL_ZERO_SKIP=true; shift; continue
     ;;
+    --skip-openpgl)
+      P{ENPGL_SKIP=true; shift; continue
+    ;;
     --)
       # no more arguments to parse
       break
@@ -1173,6 +1201,9 @@ XR_OPENXR_REPO_BRANCH="master"
 
 LEVEL_ZERO_SOURCE=("https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz")
 
+OPENPGL_USE_REPO=false
+OPENPGL_SOURCE=( "https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/v${OPENPGL_VERSION}-beta.tar.gz" )
+
 FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
 
 # C++11 is required now
@@ -1227,7 +1258,8 @@ You may also want to build them yourself (optional ones are [between brackets]):
     * [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).
     * [Universal Scene Description $USD_VERSION] (from $USD_SOURCE).
     * [OpenXR-SDK $XR_OPENXR_VERSION] (from $XR_OPENXR_SOURCE).
-    * [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).\""
+    * [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).
+    * [OpenPGL $OPENPGL_VERSION] (from $OPENPGL_SOURCE).\""
 
 if [ "$DO_SHOW_DEPS" = true ]; then
   PRINT ""
@@ -1661,6 +1693,7 @@ _update_deps_tbb() {
     USD_FORCE_BUILD=true
     EMBREE_FORCE_BUILD=true
     OIDN_FORCE_BUILD=true
+    OPENPGL_FORCE_BUILD=true
   fi
   if [ "$2" = true ]; then
     OSD_FORCE_REBUILD=true
@@ -1668,6 +1701,7 @@ _update_deps_tbb() {
     USD_FORCE_REBUILD=true
     EMBREE_FORCE_REBUILD=true
     OIDN_FORCE_REBUILD=true
+    OPENPGL_FORCE_REBUILD=true
   fi
 }
 
@@ -3306,7 +3340,12 @@ _init_embree() {
 }
 
 _update_deps_embree() {
-  :
+  if [ "$1" = true ]; then
+    OPENPGL_FORCE_BUILD=true
+  fi
+  if [ "$2" = true ]; then
+    OPENPGL_FORCE_REBUILD=true
+  fi
 }
 
 clean_Embree() {
@@ -3325,7 +3364,7 @@ compile_Embree() {
   fi
 
   # To be changed each time we make edits that would modify the compiled results!
-  embree_magic=11
+  embree_magic=12
   _init_embree
 
   # Force having own builds for the dependencies.
@@ -3962,6 +4001,112 @@ compile_Level_Zero() {
 }
 
 
+# ----------------------------------------------------------------------------
+# Build OpenPGL
+
+_init_openpgl() {
+  _src=$SRC/openpgl-$OPENPGL_VERSION
+  _git=false
+  _inst=$INST/openpgl-$OPENPGL_VERSION_SHORT
+  _inst_shortcut=$INST/openpgl
+}
+
+_update_deps_openpgl() {
+  :
+}
+
+clean_OpenPGL() {
+  _init_openpgl
+  if [ -d $_inst ]; then
+    # Force rebuilding the dependencies if needed.
+    _update_deps_openpgl false true
+  fi
+  _clean
+}
+
+compile_OpenPGL() {
+  if [ "$NO_BUILD" = true ]; then
+    WARNING "--no-build enabled, OpenPGL will not be compiled!"
+    return
+  fi
+
+  # To be changed each time we make edits that would modify the compiled results!
+  openpgl_magic=1
+  _init_openpgl
+
+  # Force having own builds for the dependencies.
+  _update_deps_openpgl true false
+
+  # Clean install if needed!
+  magic_compile_check openpgl-$OPENPGL_VERSION $openpgl_magic
+  if [ $? -eq 1 -o "$OPENPGL_FORCE_REBUILD" = true ]; then
+    clean_OpenPGL
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building OpenPGL-$OPENPGL_VERSION"
+
+    # Force rebuilding the dependencies.
+    _update_deps_openpgl true true
+
+    prepare_inst
+
+    if [ ! -d $_src ]; then
+      mkdir -p $SRC
+      download OPENPGL_SOURCE[@] "$_src.tar.gz"
+      INFO "Unpacking OpenPGL-$OPENPGL_VERSION"
+      tar -C $SRC --transform "s,(.*/?)openpgl-$OPENPGL_VERSION-beta[^/]*(.*),\1openpgl-$OPENPGL_VERSION\2,x" \
+          -xf $_src.tar.gz
+    fi
+
+    cd $_src
+
+    INFO "$_src"
+
+    # Always refresh the whole build!
+    if [ -d build ]; then
+      rm -rf build
+    fi
+    mkdir build
+    cd build
+
+    cmake_d="-D CMAKE_BUILD_TYPE=Release"
+    cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
+    cmake_d="$cmake_d -D OPENPGL_BUILD_STATIC=OFF"
+    cmake_d="$cmake_d -D OPENPGL_BUILD_PYTHON=OFF"
+    cmake_d="$cmake_d -D EMBREE_ISPC_SUPPORT=OFF"
+    if [ -d $INST/tbb ]; then
+      cmake_d="$cmake_d -D OPENPGL_TBB_ROOT=$INST/tbb"
+      cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
+    fi
+
+    cmake $cmake_d ../
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ ! -d $_inst ]; then
+      ERROR "OpenPGL-$OPENPGL_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set openpgl-$OPENPGL_VERSION $openpgl_magic
+
+    cd $CWD
+    INFO "Done compiling OpenPGL-$OPENPGL_VERSION!"
+  else
+    INFO "Own OpenPGL-$OPENPGL_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-openpgl option."
+  fi
+
+  if [ -d $_inst ]; then
+    _create_inst_shortcut
+  fi
+
+  run_ldconfig "openpgl"
+}
+
+
 # ----------------------------------------------------------------------------
 # Install on DEB-like
 
@@ -4064,7 +4209,8 @@ install_DEB() {
              libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
              libopenal-dev libepoxy-dev yasm \
              libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
-             libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev"
+             libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev \
+             libglfw3-dev"
 
   VORBIS_USE=true
   OGG_USE=true
@@ -4594,6 +4740,18 @@ install_DEB() {
     PRINT ""
     compile_Level_Zero
   fi
+
+  PRINT ""
+  if [ "$OPENPGL_SKIP" = true ]; then
+    WARNING "Skipping OpenPGL installation, as requested..."
+  elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
+    INFO "Forced OpenPGL building, as requested..."
+    compile_OpenPGL
+  else
+    # No package currently!
+    PRINT ""
+    compile_OpenPGL
+  fi
 }
 
 
@@ -5301,6 +5459,18 @@ install_RPM() {
     PRINT ""
     compile_Level_Zero
   fi
+
+  PRINT ""
+  if [ "$OPENPGL_SKIP" = true ]; then
+    WARNING "Skipping OpenPGL installation, as requested..."
+  elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
+    INFO "Forced OpenPGL building, as requested..."
+    compile_OpenPGL
+  else
+    # No package currently!
+    PRINT ""
+    compile_OpenPGL
+  fi
 }
 
 


@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list