[Bf-blender-cvs] [8e4f55aba6d] master: build_env: Added OpenImageDenoise to install_deps.sh

Stefan Werner noreply at git.blender.org
Fri Aug 16 14:01:58 CEST 2019


Commit: 8e4f55aba6d5ed2eca7d11fb7e6fc942e4a4d492
Author: Stefan Werner
Date:   Fri Aug 16 11:25:31 2019 +0200
Branches: master
https://developer.blender.org/rB8e4f55aba6d5ed2eca7d11fb7e6fc942e4a4d492

build_env: Added OpenImageDenoise to install_deps.sh

Building OIDN still needs to be enabled explicitly with --with-oidn.
It will fail with older versions of CMake or TBB, so I can't make
any guarantees for various Linux distributions or versions.

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

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 1324616ca35..a9118be93c7 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -26,17 +26,17 @@ ARGS=$( \
 getopt \
 -o s:i:t:h \
 --long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
-with-all,with-opencollada,with-jack,with-embree,\
+with-all,with-opencollada,with-jack,with-embree,with-oidn,\
 ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
 force-all,force-python,force-numpy,force-boost,\
 force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
-force-ffmpeg,force-opencollada,force-alembic,force-embree,\
+force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,\
 build-all,build-python,build-numpy,build-boost,\
 build-ocio,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
-build-ffmpeg,build-opencollada,build-alembic,build-embree,\
+build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,\
 skip-python,skip-numpy,skip-boost,\
 skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
-skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree \
+skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn \
 -- "$@" \
 )
 
@@ -57,6 +57,7 @@ WITH_ALL=false
 # Do not yet enable opencollada or embree, use --with-opencollada/--with-embree (or --with-all) option to try it.
 WITH_OPENCOLLADA=false
 WITH_EMBREE=false
+WITH_OIDN=false
 
 THREADS=$(nproc)
 
@@ -69,6 +70,7 @@ Number of threads for building: \$THREADS (automatically detected, use --threads
 Full install: \$WITH_ALL (use --with-all option to enable it).
 Building OpenCOLLADA: \$WITH_OPENCOLLADA (use --with-opencollada option to enable it).
 Building Embree: \$WITH_EMBREE (use --with-embree option to enable it).
+Building OpenImageDenoise: \$WITH_OIDN (use --with-oidn option to enable it).
 
 Example:
 Full install without OpenCOLLADA: --with-all --skip-opencollada
@@ -118,6 +120,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --with-embree
         Build and install the Embree libraries.
 
+    --with-oidn
+        Build and install the OpenImageDenoise libraries.
+
     --with-jack
         Install the jack libraries.
 
@@ -185,6 +190,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --build-embree
         Force the build of Embree.
 
+    --build-oidn
+        Force the build of OpenImageDenoise.
+
     --build-ffmpeg
         Force the build of FFMpeg.
 
@@ -240,6 +248,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --force-embree
         Force the rebuild of Embree.
 
+    --force-oidn
+        Force the rebuild of OpenImageDenoise.
+
     --force-ffmpeg
         Force the rebuild of FFMpeg.
 
@@ -288,6 +299,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --skip-Embree
         Unconditionally skip Embree installation/building.
 
+    --skip-oidn
+        Unconditionally skip OpenImageDenoise installation/building.
+
     --skip-ffmpeg
         Unconditionally skip FFMpeg installation/building.\""
 
@@ -390,6 +404,11 @@ EMBREE_FORCE_BUILD=false
 EMBREE_FORCE_REBUILD=false
 EMBREE_SKIP=false
 
+OIDN_VERSION="1.0.0"
+OIDN_FORCE_BUILD=false
+OIDN_FORCE_REBUILD=false
+OIDN_SKIP=false
+
 FFMPEG_VERSION="4.0.2"
 FFMPEG_VERSION_MIN="2.8.4"
 FFMPEG_FORCE_BUILD=false
@@ -526,6 +545,9 @@ while true; do
     --with-embree)
       WITH_EMBREE=true; shift; continue
     ;;
+    --with-oidn)
+      WITH_OIDN=true; shift; continue
+    ;;
     --with-jack)
       WITH_JACK=true; shift; continue;
     ;;
@@ -572,6 +594,7 @@ while true; do
       OPENVDB_FORCE_BUILD=true
       OPENCOLLADA_FORCE_BUILD=true
       EMBREE_FORCE_BUILD=true
+      OIDN_FORCE_BUILD=true
       FFMPEG_FORCE_BUILD=true
       ALEMBIC_FORCE_BUILD=true
       shift; continue
@@ -616,6 +639,9 @@ while true; do
     --build-embree)
       EMBREE_FORCE_BUILD=true; shift; continue
     ;;
+    --build-oidn)
+      OIDN_FORCE_BUILD=true; shift; continue
+    ;;
     --build-ffmpeg)
       FFMPEG_FORCE_BUILD=true; shift; continue
     ;;
@@ -635,6 +661,7 @@ while true; do
       OPENVDB_FORCE_REBUILD=true
       OPENCOLLADA_FORCE_REBUILD=true
       EMBREE_FORCE_REBUILD=true
+      OIDN_FORCE_REBUILD=true
       FFMPEG_FORCE_REBUILD=true
       ALEMBIC_FORCE_REBUILD=true
       shift; continue
@@ -677,6 +704,9 @@ while true; do
     --force-embree)
       EMBREE_FORCE_REBUILD=true; shift; continue
     ;;
+    --force-oidn)
+      OIDN_FORCE_REBUILD=true; shift; continue
+    ;;
     --force-ffmpeg)
       FFMPEG_FORCE_REBUILD=true; shift; continue
     ;;
@@ -719,6 +749,9 @@ while true; do
     --skip-embree)
       EMBREE_SKIP=true; shift; continue
     ;;
+    --skip-oidn)
+      OIDN_SKIP=true; shift; continue
+    ;;
     --skip-ffmpeg)
       FFMPEG_SKIP=true; shift; continue
     ;;
@@ -746,6 +779,9 @@ fi
 if [ "$WITH_ALL" = true -a "$EMBREE_SKIP" = false ]; then
   WITH_EMBREE=true
 fi
+if [ "$WITH_ALL" = true -a "$OIDN_SKIP" = false ]; then
+  WITH_OIDN=true
+fi
 if [ "$WITH_ALL" = true ]; then
   WITH_JACK=true
 fi
@@ -840,6 +876,11 @@ EMBREE_SOURCE=( "https://github.com/embree/embree/archive/v${EMBREE_VERSION}.tar
 #~ EMBREE_REPO_UID="4a12bfed63c90e85b6eab98b8cdd8dd2a3ba5809"
 #~ EMBREE_REPO_BRANCH="master"
 
+OIDN_USE_REPO=false
+OIDN_SOURCE=( "https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz" )
+#~ OIDN_SOURCE_REPO=( "https://github.com/OpenImageDenoise/oidn.git" )
+#~ OIDN_REPO_UID="dabfd9c80101edae9d25a710160d12d6d963c591"
+#~ OIDN_REPO_BRANCH="master"
 
 FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
 
@@ -882,6 +923,7 @@ You may also want to build them yourself (optional ones are [between brackets]):
     * [OpenVDB $OPENVDB_VERSION_MIN] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE).
     * [OpenCollada $OPENCOLLADA_VERSION] (from $OPENCOLLADA_SOURCE).
     * [Embree $EMBREE_VERSION] (from $EMBREE_SOURCE).
+    * [OpenImageDenoise $OIDN_VERSION] (from $OIDN_SOURCE).
     * [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).\""
 
 if [ "$DO_SHOW_DEPS" = true ]; then
@@ -2552,6 +2594,96 @@ compile_Embree() {
   fi
 }
 
+#### Build OpenImageDenoise ####
+_init_oidn() {
+  _src=$SRC/oidn-$OIDN_VERSION
+  _git=true
+  _inst=$INST/oidn-$OIDN_VERSION
+  _inst_shortcut=$INST/oidn
+}
+
+clean_oidn() {
+  _init_oidn
+  _clean
+}
+
+compile_OIDN() {
+  if [ "$NO_BUILD" = true ]; then
+    WARNING "--no-build enabled, OpenImageDenoise will not be compiled!"
+    return
+  fi
+
+  # To be changed each time we make edits that would modify the compiled results!
+  oidn_magic=9
+  _init_oidn
+
+  # Clean install if needed!
+  magic_compile_check oidn-$OIDN_VERSION $oidn_magic
+  if [ $? -eq 1 -o "$OIDN_FORCE_REBUILD" = true ]; then
+    clean_oidn
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building OpenImageDenoise-$OIDN_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      mkdir -p $SRC
+      if [ "OIDN_USE_REPO" = true ]; then
+        git clone $OIDN_SOURCE_REPO $_src
+      else
+        download OIDN_SOURCE[@] "$_src.tar.gz"
+        INFO "Unpacking OpenImageDenoise-$OIDN_VERSION"
+        tar -C $SRC -xf $_src.tar.gz
+      fi
+    fi
+
+    cd $_src
+
+    if [ "$OIDN_USE_REPO" = true ]; then
+      git pull origin $OIDN_REPO_BRANCH
+
+      # Stick to same rev as windows' libs...
+      git checkout $OIDN_REPO_UID
+      git reset --hard
+    fi
+
+    # 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 WITH_EXAMPLE=OFF"
+    cmake_d="$cmake_d -D WITH_TEST=OFF"
+    cmake_d="$cmake_d -D OIDN_STATIC_LIB=ON"
+
+    cmake $cmake_d ../
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ -d $_inst ]; then
+      _create_inst_shortcut
+    else
+      ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set oidn-$OIDN_VERSION $oidn_magic
+
+    cd $CWD
+    INFO "Done compiling OpenImageDenoise-$OIDN_VERSION!"
+  else
+    INFO "Own OpenImageDenoise-$OIDN_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-oidn option."
+  fi
+}
+
 #### Build FFMPEG ####
 _init_ffmpeg() {
   _src=$SRC/ffmpeg-$FFMPEG_VERSION
@@ -3148,6 +3280,24 @@ install_DEB() {
     fi
   fi
 
+  if [ "$WITH_OIDN" = true ]; then
+    _do_compile_oidn=false
+    PRINT ""
+    if [ "$OIDN_SKIP" = true ]; then
+      WARNING "Skipping OpenImgeDenoise installation, as requested..."
+    elif [ "$OIDN_FORCE_BUILD" = true ]; then
+      INFO "Forced OpenImageDenoise building, as requested..."
+      _do_compile_oidn=true
+    else
+      # No package currently!
+      _do_compile_oidn=true
+    fi
+
+    if [ "$_do_compile_oidn" = true ]; then
+      compile_OIDN
+    fi
+  fi
+
   PRINT ""
   if [ "$FFMPEG_SKIP" = true ]; then
     WARNING "Skipping FFMpeg installation, as requested..."
@@ -3722,6 +3872,24 @@ install_RPM() {
     fi
   fi
 
+  if [ "$WITH_OIDN" = true ]; then
+    _do_compile_oidn=false
+    PRINT ""
+    if [ "$OIDN_SKIP" = true ]; then
+      WARNING "Skipping OpenImgeDenoise installation, as requested..."
+    elif [ "$OIDN_FORCE_BUILD" = true ]; then
+      INFO "Forced OpenImageDenoise building, as requested..."
+      _do_compile_oidn=true
+    else
+      # No package currently!
+      _do_compile_oidn=true
+    fi
+
+    if [ "$_do_compile_oidn" = true ]; then
+      compile_OIDN
+    fi
+  fi
+
   PRINT ""
   if [ "$FFMPEG_SKIP" = true ]; then
     WARNING "Skipping FFMpeg installation, as requested..."
@@ -4186,6 +4354,24 @@ install_ARCH() {
     fi
   fi
 
+  if [ "$WITH_OIDN" = true ]; then
+    _do_compile_oidn=false
+    PRINT ""
+    if [ "$OIDN_SKIP" = true ]; then
+      WARNING "Skipping OpenImgeDenoise installation, as requested..."
+    elif [ "$OIDN_FORCE_BUILD" = true ]; then
+      INFO "Forced OpenImageDenoise building, as requested..."
+      

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list