[Bf-blender-cvs] [f237f67] alembic_pointcache: Alembic support in the install_deps.sh script.

Lukas Tönne noreply at git.blender.org
Thu Oct 16 16:54:18 CEST 2014


Commit: f237f67a99dd91cf076258f326105abb2894fcf0
Author: Lukas Tönne
Date:   Thu Oct 16 15:49:00 2014 +0200
Branches: alembic_pointcache
https://developer.blender.org/rBf237f67a99dd91cf076258f326105abb2894fcf0

Alembic support in the install_deps.sh script.

This is a rough-and-ready way of building and installing the Alembic
library and the necessary dependencies (excluding as much as possible
for now). The Alembic cmake files are very badly constructed and require
some annoying hacks atm. Eventually we might try to supply them with
patches or write our own build scripts for Alembic.

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

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 4ed0399..1fba4ed 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -95,6 +95,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --with-opencollada
         Build and install the OpenCOLLADA libraries.
 
+    --with-alembic
+        Build and install the Alembic library.
+
     --ver-ocio=<ver>
         Force version of OCIO library.
 
@@ -144,6 +147,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --force-ffmpeg
         Force the rebuild of FFMpeg.
 
+    --force-alembic
+        Force the rebuild of Alembic.
+
     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)!
@@ -180,6 +186,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
     --skip-ffmpeg
         Unconditionally skip FFMpeg installation/building.
 
+    --skip-alembic
+        Unconditionally skip Alembic installation/building.
+
     --required-numpy
         Use this in case your distro features a valid python package, but no matching Numpy one.
         It will force compilation of both python and numpy\""
@@ -264,6 +273,11 @@ MP3LAME_DEV=""
 OPENJPEG_USE=false
 OPENJPEG_DEV=""
 
+ALEMBIC_VERSION="1.5.5"
+ALEMBIC_VERSION_MIN="1.5.5"
+ALEMBIC_FORCE_REBUILD=false
+ALEMBIC_SKIP=false
+
 # Switch to english language, else some things (like check_package_DEB()) won't work!
 LANG_BACK=$LANG
 LANG=""
@@ -423,6 +437,9 @@ while true; do
     --force-ffmpeg)
       FFMPEG_FORCE_REBUILD=true; shift; continue
     ;;
+    --force-alembic)
+      ALEMBIC_FORCE_REBUILD=true; shift; continue
+    ;;
     --skip-python)
       PYTHON_SKIP=true; shift; continue
     ;;
@@ -453,6 +470,9 @@ while true; do
     --skip-ffmpeg)
       FFMPEG_SKIP=true; shift; continue
     ;;
+    --skip-alembic)
+      ALEMBIC_SKIP=true; shift; continue
+    ;;
     --required-numpy)
       NUMPY_REQUIRED=true; shift; continue
     ;;
@@ -505,6 +525,9 @@ OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
 OPENCOLLADA_REPO_UID="18da7f4109a8eafaa290a33f5550501cc4c8bae8"
 FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
 
+ALEMBIC_SOURCE=( "https://code.google.com/p/alembic/" )
+ALEMBIC_REPO_UID=( "1_05_05" )
+
 
 ##### Generic Helpers #####
 
@@ -831,6 +854,7 @@ compile_Boost() {
     # Rebuild dependecies as well!
     OIIO_FORCE_REBUILD=true
     OSL_FORCE_REBUILD=true
+    ALEMBIC_FORCE_REBUILD=true
 
     prepare_opt
 
@@ -1687,6 +1711,162 @@ compile_FFmpeg() {
   fi
 }
 
+#### Build ALEMBIC ####
+_init_alembic() {
+  _src=$SRC/Alembic-$ALEMBIC_VERSION
+  _hg=false
+  _inst=$INST/alembic-$ALEMBIC_VERSION
+  _inst_shortcut=$INST/alembic
+}
+
+clean_alembic() {
+  _init_alembic
+  _clean
+}
+
+compile_alembic() {
+  # To be changed each time we make edits that would modify the compiled result!
+  alembic_magic=1
+  _init_alembic
+
+  # Clean install if needed!
+  magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
+  if [ $? -eq 1 -o $ALEMBIC_FORCE_REBUILD == true ]; then
+    clean_alembic
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building Alembic-$ALEMBIC_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      mkdir -p $SRC
+      hg clone -u $ALEMBIC_REPO_UID $ALEMBIC_SOURCE $_src
+    fi
+
+    cd $_src
+
+    # XXX Ugly patching hack!
+    # Alembice cmake files are erratic, to say the least
+    # have to manually disable a bunch of crap here
+    cat << EOF | patch -p1
+--- a/CMakeLists.txt	Mon Jul 28 10:09:21 2014 -0700
++++ b/CMakeLists.txt	Thu Oct 16 15:03:27 2014 +0200
+@@ -57,9 +57,9 @@
+      ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} )
+ SET( VERSION ${PROJECT_VERSION} )
+ 
+-SET( ALEMBIC_NO_TESTS FALSE )
+-SET( ALEMBIC_NO_BOOTSTRAP FALSE )
+-SET( ALEMBIC_NO_OPENGL FALSE )
++SET( ALEMBIC_NO_TESTS TRUE )
++SET( ALEMBIC_NO_BOOTSTRAP TRUE )
++SET( ALEMBIC_NO_OPENGL TRUE )
+ 
+ MESSAGE(STATUS "CMAKE SYSTEM NAME = ${CMAKE_SYSTEM_NAME}" )
+ 
+@@ -306,15 +306,15 @@
+ ENDIF()
+ 
+ # Include PyAlembic stuff
+-IF(DEFINED USE_PYALEMBIC AND NOT USE_PYALEMBIC)
+-    MESSAGE(STATUS "Skipping Alembic Python bindings")
+-ELSE()
+-    MESSAGE(STATUS "About to include Python cmake files")
+-    ADD_SUBDIRECTORY( python )
+-ENDIF()
++#IF(DEFINED USE_PYALEMBIC AND NOT USE_PYALEMBIC)
++#    MESSAGE(STATUS "Skipping Alembic Python bindings")
++#ELSE()
++#    MESSAGE(STATUS "About to include Python cmake files")
++#    ADD_SUBDIRECTORY( python )
++#ENDIF()
+ 
+ # Example code not supported
+-ADD_SUBDIRECTORY( examples )
++#ADD_SUBDIRECTORY( examples )
+ 
+ # Uncomment to build python docs Makefile (requires Sphinx)
+ # Run `make docs` from build root
+
+EOF
+
+    cat << EOF | patch -p1
+--- a/lib/Alembic/Util/CMakeLists.txt	Mon Jul 28 10:09:21 2014 -0700
++++ b/lib/Alembic/Util/CMakeLists.txt	Thu Oct 16 15:03:27 2014 +0200
+@@ -65,7 +65,7 @@
+          DESTINATION include/Alembic/Util
+          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ )
+ 
+-IF( NOT ALEMBIC_NO_TESTS )
+-	ADD_SUBDIRECTORY( Tests )
+-ENDIF()
++#IF( NOT ALEMBIC_NO_TESTS )
++#	ADD_SUBDIRECTORY( Tests )
++#ENDIF()
+
+EOF 
+
+    cat << EOF | patch -p1
+--- a/python/CMakeLists.txt	Mon Jul 28 10:09:21 2014 -0700
++++ b/python/CMakeLists.txt	Thu Oct 16 14:20:25 2014 +0200
+@@ -35,4 +35,4 @@
+ 
+ ADD_SUBDIRECTORY( PyAlembic )
+ ADD_SUBDIRECTORY( PyAbcOpenGL )
+-ADD_SUBDIRECTORY( examples )
++#ADD_SUBDIRECTORY( examples )
+
+EOF
+
+    # Always refresh the whole build!
+    # XXX 'build' directory is included in Alembic sources, don't touch that
+    if [ -d blender_build ]; then
+      rm -rf blender_build
+    fi
+    mkdir blender_build
+    cd blender_build
+
+    # XXX Alembic cmake doesn't take these as options
+    export ALEMBIC_INSTALL_PREFIX=$_inst
+    export CMAKE_BUILD_TYPE=Release
+
+    cmake_d="-D BUILD_SHARED_LIBS=ON"
+    cmake_d="$cmake_d -D BUILD_STATIC_LIBS=ON"
+    cmake_d="$cmake_d -D USE_PYTHON=OFF"
+    cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
+    cmake_d="$cmakd_d -D ALEMBIC_PYTHON_INCLUDE_DIR=/use/include/python2.7" # XXX BAD
+    cmake_d="$cmakd_d -D ALEMBIC_PYTHON_LIBRARY=/use/lib/python2.7" # XXX BAD
+    cmake_d="$cmake_d -D USE_PYILMBASE=OFF"
+    cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
+    cmake_d="$cmake_d -D ALEMBIC_ILMBASE_HALF_LIB=$INST/openexr/lib/libHalf.la"
+    cmake_d="$cmake_d -D ALEMBIC_ILMBASE_IEX_LIB=$INST/openexr/lib/libIex-2_1.la"
+    cmake_d="$cmake_d -D ALEMBIC_ILMBASE_ILMTHREAD_LIB=$INST/openexr/lib/libIlmThread-2_1.la"
+    cmake_d="$cmake_d -D ALEMBIC_ILMBASE_IMATH_LIB=$INST/openexr/lib/libImath-2_1.la"
+
+    cmake $cmake_d ../
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ -d $_inst ]; then
+      _create_inst_shortcut
+    else
+      ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic
+
+    cd $CWD
+    INFO "Done compiling Alembic-$ALEMBIC_VERSION!"
+  else
+    INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-alembic option."
+  fi
+}
+
 
 #### Install on DEB-like ####
 get_package_version_DEB() {
@@ -1973,7 +2153,8 @@ install_DEB() {
       if [ $? -eq 0 ]; then
         install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
                              libboost-regex$boost_version-dev libboost-system$boost_version-dev \
-                             libboost-thread$boost_version-dev
+                             libboost-thread$boost_version-dev libboost-python$boost_version-dev \
+                             libboost-program-options$boost_version-dev
         clean_Boost
       else
         compile_Boost
@@ -2106,6 +2287,14 @@ install_DEB() {
 #    fi
     compile_FFmpeg
   fi
+
+  if $ALEMBIC_SKIP; then
+    WARNING "Skipping Alembic installation, as requested..."
+  else
+    install_packages_DEB libhdf5-dev
+    install_packages_DEB libpython2.7-dev # XXX nasty hack, should be done better ...
+    compile_alembic
+  fi
 }




More information about the Bf-blender-cvs mailing list