summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2010-09-28 19:02:51 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2010-09-28 19:02:51 (GMT)
commit3fbd018d8bd317b47587e20e234b7687aaa8df44 (patch)
treece6f47596ee424f43808fed02e87391e44c43080
parent453e1fa94484c9dfb0e356eeb3ab945fc26d5792 (diff)
downloadhdf5-3fbd018d8bd317b47587e20e234b7687aaa8df44.zip
hdf5-3fbd018d8bd317b47587e20e234b7687aaa8df44.tar.gz
hdf5-3fbd018d8bd317b47587e20e234b7687aaa8df44.tar.bz2
[svn-r19487] Add ExternalProject support for external libs - option added Defaults to NO. SVN allows downloading project from svn. Future option is to use a tar file.
Tested: Windows, local Linux
-rw-r--r--CMakeLists.txt114
1 files changed, 96 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d38b98c..d79fc90 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -433,20 +433,57 @@ HDF5_SETUP_FILTERS (FLETCHER32)
HDF5_SETUP_FILTERS (NBIT)
HDF5_SETUP_FILTERS (SCALEOFFSET)
+INCLUDE (ExternalProject)
+OPTION (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building" "NO")
+
#-----------------------------------------------------------------------------
# Option for ZLib support
#-----------------------------------------------------------------------------
OPTION (HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF)
IF (HDF5_ENABLE_Z_LIB_SUPPORT)
IF (NOT H5_ZLIB_HEADER)
- FIND_PACKAGE (ZLIB REQUIRED)
+ FIND_PACKAGE (ZLIB)
IF (ZLIB_FOUND)
SET (H5_HAVE_FILTER_DEFLATE 1)
SET (H5_HAVE_ZLIB_H 1)
SET (H5_HAVE_LIBZ 1)
SET (H5_ZLIB_HEADER "zlib.h")
ELSE (ZLIB_FOUND)
- MESSAGE (FATAL " ZLib is Required for ZLib support in HDF5")
+ IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+ EXTERNALPROJECT_ADD (ZLIB
+ SVN_REPOSITORY http://svn.hdfgroup.uiuc.edu/zlib/trunk
+ # [SVN_REVISION rev]
+ INSTALL_COMMAND ""
+ CMAKE_ARGS
+ -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+ )
+ EXTERNALPROJECT_GET_PROPERTY (ZLIB BINARY_DIR SOURCE_DIR)
+
+ IF (BUILD_SHARED_LIBS)
+ SET (ZLIB_LIBRARY
+ "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}zlib1${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+ )
+ ELSE (BUILD_SHARED_LIBS)
+ SET (ZLIB_LIBRARY
+ "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}zlib${CMAKE_STATIC_LIBRARY_SUFFIX}"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ SET (ZLIB_INCLUDE_DIR_GEN
+ "${BINARY_DIR}"
+ )
+ SET (ZLIB_INCLUDE_DIR
+ "${SOURCE_DIR}/src"
+ )
+
+ SET (ZLIB_FOUND 1)
+ SET (ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+ SET (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR})
+ SET (H5_HAVE_FILTER_DEFLATE 1)
+ SET (H5_HAVE_ZLIB_H 1)
+ SET (H5_HAVE_LIBZ 1)
+ ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+ MESSAGE (FATAL " ZLib is Required for ZLib support in HDF5")
+ ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
ENDIF (ZLIB_FOUND)
ELSE (NOT H5_ZLIB_HEADER)
# This project is being called from within another and ZLib is already configured
@@ -465,23 +502,57 @@ ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT)
SET (CMAKE_MODULE_PATH ${HDF5_RESOURCES_DIR} ${CMAKE_MODULE_PATH})
OPTION (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF)
IF (HDF5_ENABLE_SZIP_SUPPORT)
- FIND_PACKAGE (SZIP REQUIRED)
+ OPTION (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
+ FIND_PACKAGE (SZIP)
IF (SZIP_FOUND)
SET (H5_HAVE_FILTER_SZIP 1)
SET (H5_HAVE_SZLIB_H 1)
SET (H5_HAVE_LIBSZ 1)
- SET (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})
- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS})
-# MESSAGE (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}")
-# MESSAGE (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}")
- MESSAGE (STATUS "Filter SZIP is ON")
- OPTION (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
- IF (HDF5_ENABLE_SZIP_ENCODING)
- SET (H5_HAVE_SZIP_ENCODER 1)
- ENDIF (HDF5_ENABLE_SZIP_ENCODING)
ELSE (SZIP_FOUND)
+ IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+ EXTERNALPROJECT_ADD (SZIP
+ SVN_REPOSITORY http://svn.hdfgroup.uiuc.edu/szip/trunk
+ # [SVN_REVISION rev]
+ INSTALL_COMMAND ""
+ CMAKE_ARGS
+ -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+ -DSZIP_ENABLE_ENCODING:BOOL=${HDF5_ENABLE_SZIP_ENCODING}
+ )
+ EXTERNALPROJECT_GET_PROPERTY (SZIP BINARY_DIR SOURCE_DIR)
+
+
+ IF (BUILD_SHARED_LIBS)
+ SET (SZIP_LIBRARY
+ "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}szip${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+ )
+ ELSE (BUILD_SHARED_LIBS)
+ SET (SZIP_LIBRARY
+ "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}szip${CMAKE_STATIC_LIBRARY_SUFFIX}"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ SET (SZIP_INCLUDE_DIR_GEN
+ "${BINARY_DIR}"
+ )
+ SET (SZIP_INCLUDE_DIR
+ "${SOURCE_DIR}/src"
+ )
+
+ SET (SZIP_FOUND 1)
+ SET (SZIP_LIBRARIES ${SZIP_LIBRARY})
+ SET (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR})
+ SET (H5_HAVE_FILTER_SZIP 1)
+ SET (H5_HAVE_SZLIB_H 1)
+ SET (H5_HAVE_LIBSZ 1)
+ ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
MESSAGE (FATAL_ERROR "SZIP is Required for SZIP support in HDF5")
+ ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
ENDIF (SZIP_FOUND)
+ SET (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})
+ INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS})
+ MESSAGE (STATUS "Filter SZIP is ON")
+ IF (HDF5_ENABLE_SZIP_ENCODING)
+ SET (H5_HAVE_SZIP_ENCODER 1)
+ ENDIF (HDF5_ENABLE_SZIP_ENCODING)
ENDIF (HDF5_ENABLE_SZIP_SUPPORT)
#-----------------------------------------------------------------------------
@@ -498,7 +569,7 @@ IF (WIN32)
GET_FILENAME_COMPONENT(ZLIB_BIN_PATH ${ZLIB_LIBRARY} PATH)
# MESSAGE (STATUS "ZLIB_BIN_PATH: ${ZLIB_BIN_PATH}")
ADD_CUSTOM_TARGET (ZLIB-Release-Copy ALL
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/
COMMENT "Copying ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}.dll to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/"
)
ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
@@ -509,7 +580,7 @@ IF (WIN32)
GET_FILENAME_COMPONENT(SZIP_BIN_PATH ${SZIP_LIBRARY} PATH)
# MESSAGE (STATUS "SZIP_BIN_PATH: ${SZIP_BIN_PATH}")
ADD_CUSTOM_TARGET (SZIP-Release-Copy ALL
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/
COMMENT "Copying ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}.dll to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/"
)
ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
@@ -543,6 +614,13 @@ ENDIF (HDF5_USE_H5DUMP_PACKED_BITS)
#-----------------------------------------------------------------------------
ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
+IF (ZLIB_FOUND)
+ ADD_DEPENDENCIES (${HDF5_LIB_TARGET} ZLIB)
+ENDIF (ZLIB_FOUND)
+IF (SZIP_FOUND)
+ ADD_DEPENDENCIES (${HDF5_LIB_TARGET} SZIP)
+ENDIF (SZIP_FOUND)
+
#-----------------------------------------------------------------------------
# Build utility to copy and strip X lines of file
#-----------------------------------------------------------------------------
@@ -664,7 +742,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
IF (HDF5_PACKAGE_EXTLIBS)
IF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
INSTALL (
- FILES ${ZLIB_INCLUDE_DIR}/zconf.h ${ZLIB_INCLUDE_DIR}/zlib.h
+ FILES ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${ZLIB_INCLUDE_DIR}/zlib.h
DESTINATION ${HDF5_INSTALL_INCLUDE_DIR}
COMPONENT headers
)
@@ -679,7 +757,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
GET_FILENAME_COMPONENT(ZLIB_BIN_PATH ${ZLIB_LIBRARY} PATH)
# message(STATUS "ZLIB_BIN_PATH: ${ZLIB_BIN_PATH}")
INSTALL(
- FILES ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}.dll
+ FILES ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${HDF5_INSTALL_BIN_DIR}
COMPONENT libraries
)
@@ -687,7 +765,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
INSTALL (
- FILES ${SZIP_INCLUDE_DIR}/SZconfig.h ${SZIP_INCLUDE_DIR}/szlib.h ${SZIP_INCLUDE_DIR}/szip_adpt.h ${SZIP_INCLUDE_DIR}/ricehdf.h
+ FILES ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${SZIP_INCLUDE_DIR}/szlib.h ${SZIP_INCLUDE_DIR}/szip_adpt.h ${SZIP_INCLUDE_DIR}/ricehdf.h
DESTINATION ${HDF5_INSTALL_INCLUDE_DIR}
COMPONENT headers
)
@@ -702,7 +780,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED)
GET_FILENAME_COMPONENT(SZIP_BIN_PATH ${SZIP_LIBRARY} PATH)
# message(STATUS "SZIP_BIN_PATH: ${ZLIB_BIN_PATH}")
INSTALL(
- FILES ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}.dll
+ FILES ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${HDF5_INSTALL_BIN_DIR}
COMPONENT libraries
)