[Bf-blender-cvs] [e60715b] alembic_pointcache: Optional HDF5 support. This is not directly linked by Alembic, so Blender has to link hdf5 itself if desired.

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


Commit: e60715b9f1e2bbcb086308b0931d589becca237f
Author: Lukas Tönne
Date:   Wed Oct 2 18:44:56 2013 +0200
Branches: alembic_pointcache
https://developer.blender.org/rBe60715b9f1e2bbcb086308b0931d589becca237f

Optional HDF5 support. This is not directly linked by Alembic, so Blender has to link hdf5 itself if desired.

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

M	CMakeLists.txt
M	build_files/cmake/Modules/FindAlembic.cmake
A	build_files/cmake/Modules/FindHDF5.cmake
M	build_files/cmake/macros.cmake

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4af19c..daca84c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -204,6 +204,7 @@ 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)" OFF)
@@ -479,6 +480,11 @@ else()
 	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)
@@ -884,9 +890,11 @@ if(UNIX AND NOT APPLE)
 
 	if(WITH_ALEMBIC)
 		find_package_wrapper(Alembic)
-
 		set(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARIES} ${BOOST_LIBRARIES})
-		set(ALEMBIC_DEFINITIONS "")
+	endif()
+
+	if(WITH_HDF5)
+		find_package_wrapper(HDF5)
 	endif()
 
 	# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
diff --git a/build_files/cmake/Modules/FindAlembic.cmake b/build_files/cmake/Modules/FindAlembic.cmake
index 8732e13..ec8cdab 100644
--- a/build_files/cmake/Modules/FindAlembic.cmake
+++ b/build_files/cmake/Modules/FindAlembic.cmake
@@ -1,18 +1,14 @@
 # - Find Alembic library
 # Find the native Alembic includes and library
 # This module defines
-#  ALEMBIC_INCLUDE_DIRS, where to find openimageio.h, Set when
-#                        OPENIMAGEIO_INCLUDE_DIR is found.
-#  OPENIMAGEIO_LIBRARIES, libraries to link against to use OpenImageIO.
-#  OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO.
-#                        This can also be an environment variable.
-#  OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO.
-#
-# also defined, but not for general use are
-#  OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library.
+#  ALEMBIC_INCLUDE_DIRS, where to find Alembic headers.
+#  ALEMBIC_LIBRARIES, libraries to link against to use Alembic.
+#  ALEMBIC_ROOT_DIR, The base directory to search for Alembic.
+#                    This can also be an environment variable.
+#  ALEMBIC_FOUND, If false, do not try to use Alembic.
 
 #=============================================================================
-# Copyright 2011 Blender Foundation.
+# Copyright 2013 Blender Foundation.
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
diff --git a/build_files/cmake/Modules/FindHDF5.cmake b/build_files/cmake/Modules/FindHDF5.cmake
new file mode 100644
index 0000000..d395519
--- /dev/null
+++ b/build_files/cmake/Modules/FindHDF5.cmake
@@ -0,0 +1,75 @@
+# - Find HDF5 library
+# Find the native hdf5 includes and library
+# This module defines
+#  HDF5_INCLUDE_DIRS, where to find hdf5 headers.
+#  HDF5_LIBRARIES, libraries to link against to use hdf5.
+#  HDF5_ROOT_DIR, The base directory to search for hdf5.
+#                 This can also be an environment variable.
+#  HDF5_FOUND, If false, do not try to use hdf5.
+
+#=============================================================================
+# Copyright 2013 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If HDF5_ROOT_DIR was defined in the environment, use it.
+IF(NOT HDF5_ROOT_DIR AND NOT $ENV{HDF5_ROOT_DIR} STREQUAL "")
+  SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR})
+ENDIF()
+
+SET(_hdf5_SEARCH_DIRS
+  ${HDF5_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+  /opt/lib/hdf5
+)
+
+SET(_hdf5_FIND_COMPONENTS
+  hdf5
+  hdf5_hl
+)
+
+FIND_PATH(_hdf5_INCLUDE_DIRS
+  NAMES
+    hdf5.h
+  HINTS
+    ${_hdf5_SEARCH_DIRS}
+)
+
+SET(_hdf5_LIBRARIES)
+FOREACH(COMPONENT ${_hdf5_FIND_COMPONENTS})
+  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+  FIND_LIBRARY(HDF5_${UPPERCOMPONENT}_LIBRARY
+    NAMES
+      ${COMPONENT}
+    HINTS
+      ${_hdf5_SEARCH_DIRS}
+    )
+  MARK_AS_ADVANCED(HDF5_${UPPERCOMPONENT}_LIBRARY)
+  LIST(APPEND _hdf5_LIBRARIES "${HDF5_${UPPERCOMPONENT}_LIBRARY}")
+ENDFOREACH()
+
+# handle the QUIETLY and REQUIRED arguments and set HDF5_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(hdf5 DEFAULT_MSG
+    _hdf5_LIBRARIES _hdf5_INCLUDE_DIRS)
+
+IF(HDF5_FOUND)
+  SET(HDF5_LIBRARIES ${_hdf5_LIBRARIES})
+  SET(HDF5_INCLUDE_DIRS ${_hdf5_INCLUDE_DIRS})
+ENDIF(HDF5_FOUND)
+
+MARK_AS_ADVANCED(
+  HDF5_INCLUDE_DIRS
+  HDF5_LIBRARIES
+)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 571f2fc..6df548f 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -268,9 +268,6 @@ macro(SETUP_LIBDIRS)
 	if(WITH_LLVM)
 		link_directories(${LLVM_LIBPATH})
 	endif()
-	if(WITH_ALEMBIC)
-		link_directories(${ALEMBIC_LIBPATH})
-	endif()
 	if(WITH_MEM_JEMALLOC)
 		link_directories(${JEMALLOC_LIBPATH})
 	endif()
@@ -412,6 +409,9 @@ macro(setup_liblinks
 	if(WITH_ALEMBIC)
 		target_link_libraries(${target} ${ALEMBIC_LIBRARIES})
 	endif()
+	if(WITH_HDF5)
+		target_link_libraries(${target} ${HDF5_LIBRARIES})
+	endif()
 	if(WIN32 AND NOT UNIX)
 		target_link_libraries(${target} ${PTHREADS_LIBRARIES})
 	endif()




More information about the Bf-blender-cvs mailing list