[Bf-blender-cvs] [f2bb125] alembic_basic_io: Update Alembic library to version 1.6, remove support for HDF5.

Kévin Dietrich noreply at git.blender.org
Fri Jul 1 12:29:30 CEST 2016


Commit: f2bb125a6a0255366aeb2d41208714aef45cceab
Author: Kévin Dietrich
Date:   Fri Jul 1 12:07:35 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBf2bb125a6a0255366aeb2d41208714aef45cceab

Update Alembic library to version 1.6, remove support for HDF5.

ALthough the FindHDF5 cmake module is still present for people to use,
HDF5 is removed from install_deps.sh. From now on, Alembic built with
HDF5 support is considered legacy and not "officially" supported.

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

M	CMakeLists.txt
M	build_files/build_environment/install_deps.sh
M	build_files/cmake/Modules/FindAlembic.cmake
M	source/blender/alembic/CMakeLists.txt
M	source/blender/alembic/intern/abc_exporter.cc
M	source/blender/alembic/intern/alembic_capi.cc
M	source/blender/editors/io/CMakeLists.txt
M	source/blender/editors/io/io_alembic.c

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4aaaee..874ed17 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -325,14 +325,19 @@ option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd
 
 # Alembic support
 option(WITH_ALEMBIC             "Enable Alembic Support" OFF)
+option(WITH_ALEMBIC_HDF5        "Enable Legacy Alembic Support" OFF)
 
 # alembic
 if(WITH_ALEMBIC)
 	find_package(Alembic)
-	find_package(HDF5)
 
-	if(NOT ALEMBIC_FOUND OR NOT HDF5_FOUND)
+	if(WITH_ALEMBIC_HDF5)
+		find_package(HDF5)
+	endif()
+
+	if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
 		set(WITH_ALEMBIC OFF)
+		set(WITH_ALEMBIC_HDF5 OFF)
 	endif()
 endif()
 
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index c5cfa87..6f57b51 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -353,10 +353,7 @@ OPENVDB_FORCE_REBUILD=false
 OPENVDB_SKIP=false
 
 # Alembic needs to be compiled for now
-HDF5_VERSION_MIN="1.8.15"
-HDF5_VERSION="1.8.17"
-
-ALEMBIC_VERSION="1.5.8"
+ALEMBIC_VERSION="1.6.0"
 ALEMBIC_VERSION_MIN=$ALEMBIC_VERSION
 ALEMBIC_FORCE_BUILD=false
 ALEMBIC_FORCE_REBUILD=false
@@ -762,7 +759,6 @@ ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.
 # ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" )
 # ALEMBIC_SOURCE_REPO_UID="e6c90d4faa32c4550adeaaf3f556dad4b73a92bb"
 # ALEMBIC_SOURCE_REPO_BRANCH="master"
-HDF5_SOURCE=("http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.17.tar.gz")  # Need to find a better source (inflexible)
 
 OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
 OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
@@ -2176,70 +2172,6 @@ compile_OPENVDB() {
   run_ldconfig "openvdb"
 }
 
-#### Build HDF5 ####
-_init_hdf5() {
-  _src=$SRC/hdf5-$HDF5_VERSION
-  _git=false
-  _inst=$INST/hdf5-$HDF5_VERSION
-  _inst_shortcut=$INST/hdf5
-}
-
-clean_HDF5() {
-  _init_hdf5
-  _clean
-}
-
-compile_HDF5() {
-    if [ "$NO_BUILD" = true ]; then
-      WARNING "--no-build enabled, HDF5 will not be compiled!"
-      return
-    fi
-
-    hdf5_magic=1
-    _init_hdf5
-
-    # Clean install if needed!
-    magic_compile_check hdf5-$HDF5_VERSION $hdf5_magic
-    if [ $? -eq 1 -o "$ALEMBIC_FORCE_REBUILD" = true ]; then
-      clean_HDF5
-    fi
-
-    if [ ! -d $_inst ]; then
-      INFO "Building HDF5-$HDF5_VERSION"
-
-      prepare_opt
-
-      if [ ! -d $_src -o true ]; then
-        mkdir -p $SRC
-        download HDF5_SOURCE[@] "$_src.tar.gz"
-
-        INFO "Unpacking HDF5-$HDF5_VERSION"
-        tar -C $SRC -xf $_src.tar.gz
-      fi
-
-      cd $_src
-
-      ./configure --prefix=$_inst --with-pic --disable-shared --enable-production --disable-debug --enable-threadsafe --with-pthread=/usr/include,/usr/lib --enable-unsupported
-
-      make -j$THREADS install
-
-      if [ -d $_inst ]; then
-        _create_inst_shortcut
-      else
-        ERROR "HDF5-$HDF5_VERSION failed to compile, exiting"
-        exit 1
-      fi
-
-      magic_compile_set hdf5-$HDF5_VERSION $hdf5_magic
-
-      cd $CWD
-      INFO "Done compiling HDF5-$HDF5_VERSION!"
-    else
-      INFO "Own HDF5-$HDF5_VERSION is up to date, nothing to do!"
-      INFO "If you want to force rebuild of this lib, use the --force-hdf5 option."
-    fi
-}
-
 #### Build Alembic ####
 _init_alembic() {
   _src=$SRC/alembic-$ALEMBIC_VERSION
@@ -2263,7 +2195,7 @@ compile_ALEMBIC() {
   PRINT ""
 
   # To be changed each time we make edits that would modify the compiled result!
-  alembic_magic=1
+  alembic_magic=2
   _init_alembic
 
   # Clean install if needed!
@@ -2295,17 +2227,19 @@ compile_ALEMBIC() {
 
     if [ "$_with_built_openexr" = true ]; then
       cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
-      cmake_d="$cmake_d -D HDF5_ROOT=$INST/hdf5"
-      cmake_d="$cmake_d -D USE_PRMAN=OFF"
-      cmake_d="$cmake_d -D USE_MAYA=OFF"
       cmake_d="$cmake_d -D USE_ARNOLD=OFF"
+      cmake_d="$cmake_d -D USE_BINARIES=OFF"
+      cmake_d="$cmake_d -D USE_EXAMPLES=OFF"
+      cmake_d="$cmake_d -D USE_HDF5=OFF"
+      cmake_d="$cmake_d -D USE_MAYA=OFF"
+      cmake_d="$cmake_d -D USE_PRMAN=OFF"
       cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
-      cmake_d="$cmake_d -D USE_PYILMBASE=OFF"
       cmake_d="$cmake_d -D USE_STATIC_BOOST=ON"
-      cmake_d="$cmake_d -D USE_STATIC_HDF5=ON"
-      cmake_d="$cmake_d -D ALEMBIC_NO_TESTS=ON"
-      cmake_d="$cmake_d -D ALEMBIC_NO_BOOTSTRAP=ON"
-      cmake_d="$cmake_d -D ALEMBIC_NO_OPENGL=ON"
+      cmake_d="$cmake_d -D USE_STATIC_HDF5=OFF"
+      cmake_d="$cmake_d -D ALEMBIC_ILMBASE_LINK_STATIC=OFF"
+      cmake_d="$cmake_d -D ALEMBIC_SHARED_LIBS=OFF"
+      cmake_d="$cmake_d -D ALEMBIC_LIB_USES_BOOST=ON"
+      cmake_d="$cmake_d -D ALEMBIC_LIB_USES_TR1=OFF"
       INFO "ILMBASE_ROOT=$INST/openexr"
     fi
 
diff --git a/build_files/cmake/Modules/FindAlembic.cmake b/build_files/cmake/Modules/FindAlembic.cmake
index 3e08a42..bce4eba 100644
--- a/build_files/cmake/Modules/FindAlembic.cmake
+++ b/build_files/cmake/Modules/FindAlembic.cmake
@@ -34,18 +34,6 @@ SET(_alembic_SEARCH_DIRS
   /opt/lib/alembic
 )
 
-SET(_alembic_FIND_COMPONENTS
-  AlembicAbc
-  AlembicAbcGeom
-  AlembicAbcCoreAbstract
-  AlembicUtil
-  AlembicAbcCoreHDF5
-  AlembicOgawa
-  AlembicAbcCoreOgawa
-  AlembicAbcMaterial
-  AlembicAbcCoreFactory
-)
-
 FIND_PATH(ALEMBIC_INCLUDE_DIR
   NAMES
     Alembic/Abc/All.h
@@ -55,29 +43,22 @@ FIND_PATH(ALEMBIC_INCLUDE_DIR
     include
 )
 
-SET(_alembic_LIBRARIES)
-FOREACH(COMPONENT ${_alembic_FIND_COMPONENTS})
-  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
-
-  FIND_LIBRARY(${UPPERCOMPONENT}_LIBRARY
-    NAMES
-      ${COMPONENT}
-    HINTS
-      ${_alembic_SEARCH_DIRS}
-    PATH_SUFFIXES
-      lib64 lib lib/static
-    )
-  MARK_AS_ADVANCED(${UPPERCOMPONENT}_LIBRARY)
-  LIST(APPEND _alembic_LIBRARIES "${${UPPERCOMPONENT}_LIBRARY}")
-ENDFOREACH()
+FIND_LIBRARY(ALEMBIC_LIBRARY
+  NAMES
+    Alembic
+  HINTS
+    ${_alembic_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib lib/static
+)
 
 # handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if 
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG _alembic_LIBRARIES ALEMBIC_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
 
 IF(ALEMBIC_FOUND)
-  SET(ALEMBIC_LIBRARIES ${_alembic_LIBRARIES})
+  SET(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY})
   SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
 ENDIF(ALEMBIC_FOUND)
 
@@ -85,7 +66,3 @@ MARK_AS_ADVANCED(
   ALEMBIC_INCLUDE_DIR
   ALEMBIC_LIBRARY
 )
-
-UNSET(COMPONENT)
-UNSET(UPPERCOMPONENT)
-UNSET(_alembic_LIBRARIES)
diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt
index cf574eb..d0bcf42 100644
--- a/source/blender/alembic/CMakeLists.txt
+++ b/source/blender/alembic/CMakeLists.txt
@@ -69,4 +69,8 @@ set(SRC
 	intern/abc_util.h
 )
 
+if(WITH_ALEMBIC_HDF5)
+	add_definitions(-DWITH_ALEMBIC_HDF5)
+endif()
+
 blender_add_lib(bf_alembic "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index 1225d91..8680450 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -24,7 +24,10 @@
 
 #include <cmath>
 
-#include <Alembic/AbcCoreHDF5/All.h>
+#ifdef WITH_ALEMBIC_HDF5
+#  include <Alembic/AbcCoreHDF5/All.h>
+#endif
+
 #include <Alembic/AbcCoreOgawa/All.h>
 
 #include "abc_camera.h"
@@ -244,14 +247,22 @@ void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled)
 
 	Alembic::Abc::Argument arg(md);
 
+#ifdef WITH_ALEMBIC_HDF5
 	if (!m_settings.export_ogawa) {
-		m_archive = Alembic::Abc::CreateArchiveWithInfo(Alembic::AbcCoreHDF5::WriteArchive(), m_filename, "Blender",
-		                                               scene_name, Alembic::Abc::ErrorHandler::kThrowPolicy, arg);
-	}
-	else {
-		m_archive = Alembic::Abc::CreateArchiveWithInfo(Alembic::AbcCoreOgawa::WriteArchive(), m_filename, "Blender",
-		                                               scene_name, Alembic::Abc::ErrorHandler::kThrowPolicy, arg);
-	}
+		m_archive = Alembic::Abc::CreateArchiveWithInfo(Alembic::AbcCoreHDF5::WriteArchive(),
+		                                                m_filename,
+		                                                "Blender",
+		                                                scene_name,
+		                                                Alembic::Abc::ErrorHandler::kThrowPolicy,
+		                                                arg);
+	}
+	else
+#endif
+		m_archive = Alembic::Abc::CreateArchiveWithInfo(Alembic::AbcCoreOgawa::WriteArchive(),
+		                                                m_filename, "Blender",
+		                                                scene_name,
+		                                                Alembic::Abc::ErrorHandler::kThrowPolicy,
+		                                                arg);
 
 	/* Create time samplings for transforms and shapes. */
 
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index 3353234..15a34db 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -22,7 +22,10 @@
 
 #include "../ABC_alembic.h"
 
-#include <Alembic/AbcCoreHDF5/All.h>
+#ifdef WITH_ALEMBIC_HDF5
+#  include <Alembic/AbcCoreHDF5/All.h>
+#endif
+
 #include <Alembic/AbcCoreOgawa/All.h>
 #include <Alembic/AbcMaterial/IMaterial.h>
 
@@ -121,20 +124,26 @@ static IArchive *open_archive(const std::string &filename)
 	IArchive *archive;
 
 	try {
-		archive = new IArchive(Alembic::AbcCoreHDF5::ReadArchive(),
+		archive = new IArchive(Alembic::AbcCoreOgawa::ReadArchive(),
 		                       filename.c_str(), ErrorHandler::kThrowPolicy,
 		                       cache_ptr);
 	}
-	catch (const Exception &) {
+	catch (const Exception &e) {
+		std::cerr << e.what() << '\n';
+
+#ifdef WITH_ALEMBIC_HDF5
 		try {
-			archive = new IArchive(Alembic::AbcCoreOgawa:

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list