[Bf-blender-cvs] [0c6df47] gooseberry: Initial Alembic library integration for Blender.
Lukas Tönne
noreply at git.blender.org
Mon Mar 23 13:00:28 CET 2015
Commit: 0c6df47e7be1c62f5d483ffc94c6cc522ce34f7c
Author: Lukas Tönne
Date: Mon Mar 23 11:49:04 2015 +0100
Branches: gooseberry
https://developer.blender.org/rB0c6df47e7be1c62f5d483ffc94c6cc522ce34f7c
Initial Alembic library integration for Blender.
Adds Alembic as a dependency and build support in cmake and scons.
Also extends the install_deps.sh script with a temporary installation
procedure for the Alembic libraries. This is still very hackish and
needs to be improved.
===================================================================
M CMakeLists.txt
M build_files/build_environment/install_deps.sh
A build_files/cmake/Modules/FindAlembic.cmake
A build_files/cmake/Modules/FindHDF5.cmake
M build_files/cmake/macros.cmake
M build_files/scons/config/linux-config.py
M build_files/scons/tools/Blender.py
M build_files/scons/tools/btools.py
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e8552f..7909f24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -275,6 +275,10 @@ option(WITH_MOD_REMESH "Enable Remesh Modifier" ON)
# mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" OFF)
+# Alembic
+option(WITH_ALEMBIC "Enable Alembic Support" OFF)
+option(WITH_HDF5 "Enable HDF5 Support for Alembic" OFF)
+
# Image format support
option(WITH_OPENIMAGEIO "Enable OpenImageIO Support (http://www.openimageio.org)" ON)
option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ${_init_IMAGE_OPENEXR})
@@ -637,17 +641,23 @@ if(NOT WITH_BOOST)
set_and_warn(WITH_CYCLES OFF)
set_and_warn(WITH_AUDASPACE OFF)
+ set_and_warn(WITH_ALEMBIC OFF)
set_and_warn(WITH_INTERNATIONAL OFF)
set_and_warn(WITH_OPENAL OFF) # depends on AUDASPACE
set_and_warn(WITH_GAMEENGINE OFF) # depends on AUDASPACE
-elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
+elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_ALEMBIC OR WITH_INTERNATIONAL)
# Keep enabled
else()
# Enabled but we don't need it
set(WITH_BOOST OFF)
endif()
+# disable hdf5 if Alembic is disabled
+if(NOT WITH_ALEMBIC)
+ set(WITH_HDF5 OFF)
+endif()
+
# auto enable openimageio for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
@@ -1128,6 +1138,15 @@ if(UNIX AND NOT APPLE)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map")
endif()
+ if(WITH_ALEMBIC)
+ find_package_wrapper(Alembic)
+ set(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARIES} ${BOOST_LIBRARIES})
+ endif()
+
+ if(WITH_HDF5)
+ find_package_wrapper(HDF5)
+ endif()
+
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
@@ -2195,6 +2214,12 @@ if(WITH_CYCLES)
endif()
endif()
+if(WITH_ALEMBIC)
+ if(NOT WITH_BOOST)
+ message(FATAL_ERROR "Alembic requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_ALEMBIC")
+ endif()
+endif()
+
if(WITH_INTERNATIONAL)
if(NOT WITH_BOOST)
message(FATAL_ERROR "Internationalization requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 1c78858..6e604a5 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
;;
@@ -513,6 +533,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 #####
@@ -839,6 +862,7 @@ compile_Boost() {
# Rebuild dependecies as well!
OIIO_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
+ ALEMBIC_FORCE_REBUILD=true
prepare_opt
@@ -1706,6 +1730,165 @@ 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
+ # XXX Alembic creates a subfolder itself ... rather than fix their
+ # stupid build files, just expect this here by using $INST as prefix
+ export ALEMBIC_INSTALL_PREFIX=$INST
+
+ cmake_d="-D CMAKE_BUILD_TYPE=Release"
+ cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$INST"
+ cmake_d="$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() {
@@ -1992,7 +2175,8 @@ install_DEB() {
if [ $? -eq 0 ]; then
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
libboost-rege
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list