[Bf-blender-cvs] [591fb3b] alembic_basic_io: Add a module to find HDF5 (split from FindAlembic.cmake)

Kévin Dietrich noreply at git.blender.org
Thu Jun 9 14:11:56 CEST 2016


Commit: 591fb3b44ee83cdfee3952a20a28c6e5b0451c67
Author: Kévin Dietrich
Date:   Thu Jun 9 10:33:31 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB591fb3b44ee83cdfee3952a20a28c6e5b0451c67

Add a module to find HDF5 (split from FindAlembic.cmake)

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

M	CMakeLists.txt
D	build_files/cmake/Modules/FindALEMBIC.cmake
A	build_files/cmake/Modules/FindAlembic.cmake
A	build_files/cmake/Modules/FindHDF5.cmake
M	build_files/cmake/macros.cmake
M	source/blender/alembic/CMakeLists.txt

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5718d4b..268177d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -318,26 +318,18 @@ option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" ${_i
 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 
 # Alembic support
-option(WITH_ALEMBIC     		"Enable Alembic Support" OFF)
-if(WITH_HDF5)
-	find_package(HDF5)
-
-	if(NOT HDF5_FOUND)
-		set(WITH_HDF5 OFF)
-		set(WITH_ALEMBIC OFF)
-	endif()
-endif()
+option(WITH_ALEMBIC             "Enable Alembic Support" OFF)
 
 # alembic
 if(WITH_ALEMBIC)
-	find_package(ALEMBIC)
+	find_package(Alembic)
+	find_package(HDF5)
 
-    if(NOT ALEMBIC_FOUND)
+	if(NOT ALEMBIC_FOUND OR NOT HDF5_FOUND)
 		set(WITH_ALEMBIC OFF)
-   endif()
+	endif()
 endif()
 
-
 if(APPLE)
 	option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" ON)
 endif()
diff --git a/build_files/cmake/Modules/FindALEMBIC.cmake b/build_files/cmake/Modules/FindAlembic.cmake
similarity index 88%
rename from build_files/cmake/Modules/FindALEMBIC.cmake
rename to build_files/cmake/Modules/FindAlembic.cmake
index 36a541c..3e08a42 100644
--- a/build_files/cmake/Modules/FindALEMBIC.cmake
+++ b/build_files/cmake/Modules/FindAlembic.cmake
@@ -27,8 +27,6 @@ ENDIF()
 
 SET(_alembic_SEARCH_DIRS
   ${ALEMBIC_ROOT_DIR}
-  ${ALEMBIC_ROOT_DIR}/lib/static
-  ${HDF5_ROOT_DIR}/lib
   /usr/local
   /sw # Fink
   /opt/local # DarwinPorts
@@ -73,16 +71,13 @@ FOREACH(COMPONENT ${_alembic_FIND_COMPONENTS})
   LIST(APPEND _alembic_LIBRARIES "${${UPPERCOMPONENT}_LIBRARY}")
 ENDFOREACH()
 
-FIND_LIBRARY(HDF5_LIBRARY 					NAMES hdf5 HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
-FIND_LIBRARY(HDF5_HL_LIBRARY 				NAMES hdf5_hl HINTS ${_alembic_SEARCH_DIRS} PATH_SUFFIXES lib64 lib)
-
 # 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)
 
 IF(ALEMBIC_FOUND)
-  SET(ALEMBIC_LIBRARIES ${_alembic_LIBRARIES} ${HDF5_LIBRARY} ${HDF5_HL_LIBRARY})
+  SET(ALEMBIC_LIBRARIES ${_alembic_LIBRARIES})
   SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
 ENDIF(ALEMBIC_FOUND)
 
diff --git a/build_files/cmake/Modules/FindHDF5.cmake b/build_files/cmake/Modules/FindHDF5.cmake
new file mode 100644
index 0000000..9f99666
--- /dev/null
+++ b/build_files/cmake/Modules/FindHDF5.cmake
@@ -0,0 +1,84 @@
+# - Find Alembic library
+# Find the native Alembic includes and libraries
+# This module defines
+#  HDF5_INCLUDE_DIRS, where to find samplerate.h, Set when
+#                        HDF5_INCLUDE_DIR is found.
+#  HDF5_LIBRARIES, libraries to link against to use Samplerate.
+#  HDF5_ROOT_DIR, The base directory to search for Samplerate.
+#                    This can also be an environment variable.
+#  HDF5_FOUND, If false, do not try to use Samplerate.
+#
+
+#=============================================================================
+# Copyright 2011 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_DIR
+  NAMES
+    hdf5.h
+  HINTS
+    ${_hdf5_SEARCH_DIRS}
+  PATH_SUFFIXES
+    include
+)
+
+SET(_hdf5_LIBRARIES)
+FOREACH(COMPONENT ${_hdf5_FIND_COMPONENTS})
+  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+  FIND_LIBRARY(${UPPERCOMPONENT}_LIBRARY
+    NAMES
+      ${COMPONENT}
+    HINTS
+      ${_hdf5_SEARCH_DIRS}
+    PATH_SUFFIXES
+      lib64 lib
+    )
+  MARK_AS_ADVANCED(${UPPERCOMPONENT}_LIBRARY)
+  LIST(APPEND _hdf5_LIBRARIES "${${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_DIR)
+
+IF(HDF5_FOUND)
+  SET(HDF5_LIBRARIES ${_hdf5_LIBRARIES})
+  SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
+ENDIF(HDF5_FOUND)
+
+MARK_AS_ADVANCED(
+  HDF5_INCLUDE_DIR
+  HDF5_LIBRARY
+)
+
+UNSET(COMPONENT)
+UNSET(UPPERCOMPONENT)
+UNSET(_hdf5_LIBRARIES)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 0b5c502..7d51dd5 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -447,7 +447,7 @@ function(setup_liblinks
 		target_link_libraries(${target} ${LLVM_LIBRARY})
 	endif()
 	if(WITH_ALEMBIC)
-		target_link_libraries(${target} ${ALEMBIC_LIBRARIES} ${HDF5_LIBRARIES} ${PYTHON_LIBRARIES})
+		target_link_libraries(${target} ${ALEMBIC_LIBRARIES} ${HDF5_LIBRARIES})
 	endif()
 	if(WIN32 AND NOT UNIX)
 		target_link_libraries(${target} ${PTHREADS_LIBRARIES})
diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt
index 6060234..adb6290 100644
--- a/source/blender/alembic/CMakeLists.txt
+++ b/source/blender/alembic/CMakeLists.txt
@@ -42,7 +42,6 @@ set(INC_SYS
 	${ALEMBIC_INCLUDE_DIRS}
 	${HDF5_INCLUDE_DIRS}
 	${OPENEXR_INCLUDE_DIRS}
-	${PYTHON_INCLUDE_DIRS}
 )
 
 set(SRC




More information about the Bf-blender-cvs mailing list