diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2010-05-13 16:01:50 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2010-05-13 16:01:50 (GMT) |
commit | ae06433ab0ca13838c2762c8fad165a041d64c42 (patch) | |
tree | 72d645731c00953c3daf6dad8a1cf0dc97326943 /hl | |
parent | 940931aa853602b0b6edfd4ca1a6526fd7975dd2 (diff) | |
download | hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.zip hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.tar.gz hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.tar.bz2 |
[svn-r18793] Add files to support building library with CMake
Tested: Local linux
Diffstat (limited to 'hl')
-rw-r--r-- | hl/CMakeLists.txt | 42 | ||||
-rw-r--r-- | hl/c++/CMakeLists.txt | 22 | ||||
-rw-r--r-- | hl/c++/examples/CMakeLists.txt | 31 | ||||
-rw-r--r-- | hl/c++/src/CMakeLists.txt | 44 | ||||
-rw-r--r-- | hl/c++/test/CMakeLists.txt | 33 | ||||
-rw-r--r-- | hl/examples/CMakeLists.txt | 36 | ||||
-rw-r--r-- | hl/fortran/CMakeLists.txt | 31 | ||||
-rw-r--r-- | hl/fortran/examples/CMakeLists.txt | 39 | ||||
-rw-r--r-- | hl/fortran/src/CMakeLists.txt | 103 | ||||
-rw-r--r-- | hl/fortran/src/H5IMcc.h | 2 | ||||
-rw-r--r-- | hl/fortran/test/CMakeLists.txt | 70 | ||||
-rw-r--r-- | hl/src/CMakeLists.txt | 65 | ||||
-rw-r--r-- | hl/test/CMakeLists.txt | 67 | ||||
-rw-r--r-- | hl/tools/CMakeLists.txt | 55 |
14 files changed, 639 insertions, 1 deletions
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt new file mode 100644 index 0000000..bc7c652 --- /dev/null +++ b/hl/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL) + +#----------------------------------------------------------------------------- +# Shared Libs +#----------------------------------------------------------------------------- +IF (BUILD_SHARED_LIBS) + SET (HL_BUILT_AS_DYNAMIC_LIB 1) +ENDIF (BUILD_SHARED_LIBS) + +#----------------------------------------------------------------------------- +# List Source files +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src ) + +ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/src ${HDF5_HL_BINARY_DIR}/src) + +#-- Build the High level Tools +IF (HDF5_BUILD_TOOLS) + ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/tools ${HDF5_HL_BINARY_DIR}/tools) +ENDIF (HDF5_BUILD_TOOLS) + +#-- Add High Level Examples +IF (HDF5_BUILD_EXAMPLES) + ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/examples ${HDF5_HL_BINARY_DIR}/examples) +ENDIF (HDF5_BUILD_EXAMPLES) + +#-- Build the Unit testing if requested +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + IF (BUILD_TESTING) + ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/test ${HDF5_HL_BINARY_DIR}/test) + ENDIF (BUILD_TESTING) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + +#-- Build the High Level Fortran source codes +IF (HDF5_BUILD_FORTRAN) + ADD_SUBDIRECTORY (fortran) +ENDIF (HDF5_BUILD_FORTRAN) + +IF (HDF5_BUILD_CPP_LIB) + ADD_SUBDIRECTORY (${HDF5_HL_SOURCE_DIR}/c++ ${HDF5_HL_BINARY_DIR}/c++) +ENDIF (HDF5_BUILD_CPP_LIB) diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt new file mode 100644 index 0000000..15ae809 --- /dev/null +++ b/hl/c++/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_CPP) + +#----------------------------------------------------------------------------- +# Main HL lib is in /src +#----------------------------------------------------------------------------- +ADD_SUBDIRECTORY (${HDF5_HL_CPP_SOURCE_DIR}/src ${HDF5_HL_CPP_BINARY_DIR}/src) + +# -------------------------------------------------------------------- +# Add in the examples for the Packet Table codes +# -------------------------------------------------------------------- +IF (HDF5_BUILD_EXAMPLES) + ADD_SUBDIRECTORY (${HDF5_HL_CPP_SOURCE_DIR}/examples ${HDF5_HL_CPP_BINARY_DIR}/examples) +ENDIF (HDF5_BUILD_EXAMPLES) + +# -------------------------------------------------------------------- +# Add in the unit tests for the packet table c++ wrapper +# -------------------------------------------------------------------- + +IF (BUILD_TESTING) + ADD_SUBDIRECTORY (${HDF5_HL_CPP_SOURCE_DIR}/test ${HDF5_HL_CPP_BINARY_DIR}/test) +ENDIF (BUILD_TESTING) diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt new file mode 100644 index 0000000..cbe2626 --- /dev/null +++ b/hl/c++/examples/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_CPP_EXAMPLES) + +#----------------------------------------------------------------------------- +# Setup include Directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SOURCE_DIR}/src) + +# -------------------------------------------------------------------- +# Add in the examples for the Packet Table codes +# -------------------------------------------------------------------- +IF (HDF5_BUILD_EXAMPLES) + ADD_EXECUTABLE (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp) + H5_NAMING (ptExampleFL) + TARGET_LINK_LIBRARIES ( + ptExampleFL + ${HDF5_HL_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) + + ADD_EXECUTABLE (ptExampleVL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleVL.cpp) + H5_NAMING (ptExampleVL) + TARGET_LINK_LIBRARIES ( + ptExampleVL + ${HDF5_HL_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) +ENDIF (HDF5_BUILD_EXAMPLES) diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt new file mode 100644 index 0000000..889b716 --- /dev/null +++ b/hl/c++/src/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_CPP_SRC) + +#----------------------------------------------------------------------------- +# Define Sources +#----------------------------------------------------------------------------- +SET (HDF5_HL_CPP_SRCS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) +SET (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) +INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR}) + +ADD_LIBRARY ( ${HDF5_HL_CPP_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_CPP_SRCS}) +TARGET_LINK_LIBRARIES ( + ${HDF5_HL_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} +) +SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") +H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} ${LIB_TYPE}) + +#----------------------------------------------------------------------------- +# Add file(s) to CMake Install +#----------------------------------------------------------------------------- +INSTALL ( + FILES + ${HDF5_HL_CPP_HDRS} + DESTINATION + include/hl/cpp +) + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +IF (HDF5_EXPORTED_TARGETS) + INSTALL ( + TARGETS + ${HDF5_HL_CPP_LIB_TARGET} + EXPORT + ${HDF5_EXPORTED_TARGETS} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + ) +ENDIF (HDF5_EXPORTED_TARGETS) diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt new file mode 100644 index 0000000..c0a94f8 --- /dev/null +++ b/hl/c++/test/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_CPP_TEST) + +#----------------------------------------------------------------------------- +# Setup include Directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SOURCE_DIR}/src) + +# -------------------------------------------------------------------- +# Add in the unit tests for the packet table c++ wrapper +# -------------------------------------------------------------------- + +IF (BUILD_TESTING) + INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR}) + INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/test) + INCLUDE_DIRECTORIES (${HDF5_CPP_SOURCE_DIR}/src) + + ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) + H5_NAMING (hl_ptableTest) + TARGET_LINK_LIBRARIES ( + hl_ptableTest + ${HDF5_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_HL_CPP_LIB_TARGET} + ) + GET_TARGET_PROPERTY (hl_ptableTestpath hl_ptableTest LOCATION) + GET_FILENAME_COMPONENT (hl_ptableTestexe ${hl_ptableTestpath} NAME) + + ADD_TEST (NAME hl_ptableTest COMMAND $<TARGET_FILE:hl_ptableTest>) +ENDIF (BUILD_TESTING) diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt new file mode 100644 index 0000000..934856a --- /dev/null +++ b/hl/examples/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_EXAMPLES ) + +#----------------------------------------------------------------------------- +# Define Sources +#----------------------------------------------------------------------------- +SET (examples + ex_lite1 + ex_lite2 + ex_lite3 + ptExampleFL + ptExampleVL + ex_image1 + ex_image2 + ex_table_01 + ex_table_02 + ex_table_03 + ex_table_04 + ex_table_05 + ex_table_06 + ex_table_07 + ex_table_08 + ex_table_09 + ex_table_10 + ex_table_11 + ex_table_12 + ex_ds1 +) + +FOREACH (example ${examples}) + ADD_EXECUTABLE (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c) + H5_NAMING (hl_ex_${example}) + TARGET_LINK_LIBRARIES (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) +ENDFOREACH (example ${examples}) + + diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt new file mode 100644 index 0000000..1be4012 --- /dev/null +++ b/hl/fortran/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT(HDF5_HL_F90 C CXX Fortran) + +#----------------------------------------------------------------------------- +# Setup include Directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${HDF5_F90_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR}) +INCLUDE_DIRECTORIES (${HDF5_F90_SRC_BINARY_DIR}) +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY}) + +LINK_DIRECTORIES (${HDF5_SRC_DIR} ${HDF5_FORTRAN_SOURCE_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + +#----------------------------------------------------------------------------- +# List Source files +#----------------------------------------------------------------------------- +ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/src ${HDF5_HL_F90_BINARY_DIR}/src) + +#----------------------------------------------------------------------------- +# Build the HL Fortran Examples +#----------------------------------------------------------------------------- +IF (HDF5_BUILD_FORTRAN_EXAMPLES) + ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/examples ${HDF5_HL_F90_BINARY_DIR}/examples) +ENDIF (HDF5_BUILD_FORTRAN_EXAMPLES) + +#----------------------------------------------------------------------------- +# Testing +#----------------------------------------------------------------------------- +IF (BUILD_TESTING) + ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/test ${HDF5_HL_F90_BINARY_DIR}/test) +ENDIF (BUILD_TESTING) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt new file mode 100644 index 0000000..64fd9df --- /dev/null +++ b/hl/fortran/examples/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran) + +#----------------------------------------------------------------------------- +# Setup include Directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src) +LINK_DIRECTORIES ( + ${CMAKE_Fortran_MODULE_DIRECTORY} + ${HDF5_HL_F90_BINARY_DIR} + ${HDF5_F90_BINARY_DIR} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} +) + +SET (examples + exlite +) + +FOREACH (example ${examples}) + ADD_EXECUTABLE (hl_f90_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.f90) + H5_NAMING (hl_f90_ex_${example}) + IF (BUILD_SHARED_LIBS) + IF (WIN32) + IF (MSVC) + SET_TARGET_PROPERTIES (hl_f90_ex_${example} + PROPERTIES + COMPILE_FLAGS "/dll" + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) + ENDIF (MSVC) + ENDIF (WIN32) + ENDIF (BUILD_SHARED_LIBS) + TARGET_LINK_LIBRARIES (hl_f90_ex_${example} + ${HDF5_HL_F90_LIB_TARGET} + ${HDF5_F90_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) + SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) +ENDFOREACH (example ${examples}) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt new file mode 100644 index 0000000..a967d54 --- /dev/null +++ b/hl/fortran/src/CMakeLists.txt @@ -0,0 +1,103 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT(HDF5_HL_F90_SRC C CXX Fortran) + +#----------------------------------------------------------------------------- +# Setup include Directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${HDF5_F90_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR}) +INCLUDE_DIRECTORIES (${HDF5_F90_SRC_BINARY_DIR}) + +INCLUDE_DIRECTORIES (${HDF5_HL_F90_SRC_SOURCE_DIR}) +INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) + +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src) +LINK_DIRECTORIES ( + ${CMAKE_Fortran_MODULE_DIRECTORY} + ${HDF5_HL_F90_BINARY_DIR} + ${HDF5_F90_BINARY_DIR} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} +) +#----------------------------------------------------------------------------- +# List Source files +#----------------------------------------------------------------------------- +#MESSAGE ("Fortran source is in ${HDF5_F90_SOURCE_DIR}/src ") + + +SET (HDF5_HL_F90_F_SRCS + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBff.f90 + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTff.f90 + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.f90 +) + +SET (HDF5_HL_F90_C_SRCS + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTfc.c + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMfc.c + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMcc.c + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBfc.c +) + +SET (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) + +ADD_LIBRARY (${HDF5_HL_F90_C_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_C_SRCS} ${HDF5_HL_F90_HEADERS}) +TARGET_LINK_LIBRARIES (${HDF5_HL_F90_C_LIB_TARGET} + ${HDF5_F90_C_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} +) +# +# To Ensure that generated files are built, we must force a dependency +# +ADD_DEPENDENCIES(${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET}) + +SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT + "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}" +) +H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} ${LIB_TYPE}) + +ADD_LIBRARY (${HDF5_HL_F90_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_F_SRCS}) +IF (BUILD_SHARED_LIBS) + IF (WIN32) + SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET} + APPEND PROPERTY COMPILE_DEFINITIONS + BUILD_HDF5_DLL + ) + IF (MSVC) + SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} + PROPERTIES + COMPILE_FLAGS "/dll" + LINK_FLAGS "/SUBSYSTEM:CONSOLE /DLL" + ) + ENDIF (MSVC) + ENDIF (WIN32) +ENDIF (BUILD_SHARED_LIBS) +IF (WIN32) + SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET} + APPEND PROPERTY COMPILE_DEFINITIONS + HDF5F90_WINDOWS + ) + SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran) +ENDIF (WIN32) +SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT + "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}" +) +TARGET_LINK_LIBRARIES (${HDF5_HL_F90_LIB_TARGET} + ${HDF5_HL_F90_C_LIB_TARGET} +) +H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} ${LIB_TYPE}) +ADD_DEPENDENCIES (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_C_LIB_TARGET}) + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +IF (HDF5_EXPORTED_TARGETS) + INSTALL ( + TARGETS + ${HDF5_HL_F90_C_LIB_TARGET} + ${HDF5_HL_F90_LIB_TARGET} + EXPORT + ${HDF5_EXPORTED_TARGETS} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + ) +ENDIF (HDF5_EXPORTED_TARGETS) diff --git a/hl/fortran/src/H5IMcc.h b/hl/fortran/src/H5IMcc.h index 9f70bac..0b8a345 100644 --- a/hl/fortran/src/H5IMcc.h +++ b/hl/fortran/src/H5IMcc.h @@ -18,7 +18,7 @@ #include "H5LTprivate.h" #include "H5IMprivate.h" -#include "../../fortran/src/H5f90i_gen.h" +#include "H5f90i_gen.h" #ifdef __cplusplus extern "C" { diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt new file mode 100644 index 0000000..41cb675 --- /dev/null +++ b/hl/fortran/test/CMakeLists.txt @@ -0,0 +1,70 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) + +#----------------------------------------------------------------------------- +# Add Tests +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src) +LINK_DIRECTORIES ( + ${CMAKE_Fortran_MODULE_DIRECTORY} + ${HDF5_HL_F90_BINARY_DIR} + ${HDF5_F90_BINARY_DIR} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} +) + +#-- Adding test for hl_f90_tstlite +ADD_EXECUTABLE (hl_f90_tstlite tstlite.f90) +H5_NAMING (hl_f90_tstlite) +IF (BUILD_SHARED_LIBS) + IF (WIN32) + IF (MSVC) + SET_TARGET_PROPERTIES (hl_f90_tstlite + PROPERTIES + COMPILE_FLAGS "/dll" + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) + ENDIF (MSVC) + ENDIF (WIN32) +ENDIF (BUILD_SHARED_LIBS) +TARGET_LINK_LIBRARIES (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) +SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) + +ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) + +#-- Adding test for hl_f90_tstimage +ADD_EXECUTABLE (hl_f90_tstimage tstimage.f90) +H5_NAMING (hl_f90_tstimage) +IF (BUILD_SHARED_LIBS) + IF (WIN32) + IF (MSVC) + SET_TARGET_PROPERTIES (hl_f90_tstimage + PROPERTIES + COMPILE_FLAGS "/dll" + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) + ENDIF (MSVC) + ENDIF (WIN32) +ENDIF (BUILD_SHARED_LIBS) +TARGET_LINK_LIBRARIES (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) +SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) + +ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) + +#-- Adding test for hl_f90_tsttable +ADD_EXECUTABLE (hl_f90_tsttable tsttable.f90) +H5_NAMING (hl_f90_tsttable) +IF (BUILD_SHARED_LIBS) + IF (WIN32) + IF (MSVC) + SET_TARGET_PROPERTIES (hl_f90_tsttable + PROPERTIES + COMPILE_FLAGS "/dll" + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) + ENDIF (MSVC) + ENDIF (WIN32) +ENDIF (BUILD_SHARED_LIBS) +TARGET_LINK_LIBRARIES (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) +SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) + +ADD_TEST (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt new file mode 100644 index 0000000..8773e50 --- /dev/null +++ b/hl/src/CMakeLists.txt @@ -0,0 +1,65 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_SRC) + +#----------------------------------------------------------------------------- +# Shared Libs +#----------------------------------------------------------------------------- +IF (BUILD_SHARED_LIBS) + SET (HL_BUILT_AS_DYNAMIC_LIB 1) +ENDIF (BUILD_SHARED_LIBS) + +#----------------------------------------------------------------------------- +# List Source files +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) + +SET (HL_SRCS + ${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5IM.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5LT.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5PT.c + ${HDF5_HL_SRC_SOURCE_DIR}/H5TB.c +) + +SET (HL_HEADERS + ${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTpublic.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5PTpublic.h + ${HDF5_HL_SRC_SOURCE_DIR}/H5TBpublic.h + ${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h +) + +ADD_LIBRARY (${HDF5_HL_LIB_TARGET} ${LIB_TYPE} ${HL_SRCS} ${HL_HEADERS}) +SET_TARGET_PROPERTIES(${HDF5_HL_LIB_TARGET} PROPERTIES DEFINE_SYMBOL ${HDF5_HL_LIB_CORENAME}_EXPORTS) +TARGET_LINK_LIBRARIES (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) +SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") +H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} ${LIB_TYPE}) + +#----------------------------------------------------------------------------- +# Add file(s) to CMake Install +#----------------------------------------------------------------------------- +INSTALL ( + FILES + ${HL_HEADERS} + DESTINATION + include +) + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +IF (HDF5_EXPORTED_TARGETS) + INSTALL ( + TARGETS + ${HDF5_HL_LIB_TARGET} + EXPORT + ${HDF5_EXPORTED_TARGETS} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + ) +ENDIF (HDF5_EXPORTED_TARGETS) diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt new file mode 100644 index 0000000..8397417 --- /dev/null +++ b/hl/test/CMakeLists.txt @@ -0,0 +1,67 @@ +cmake_minimum_required (VERSION 2.8) +# -------------------------------------------------------------------- +# Notes: When creating unit test executables they should be prefixed +# with "hl_". This allows for easier filtering of the test suite when +# using ctest. An example would be +# ctest -R hl_ +# which would only run the High Level based unit tests. +# -------------------------------------------------------------------- + +PROJECT (HDF5_HL_TEST) + +#----------------------------------------------------------------------------- +# Generate the H5srcdir_str.h file containing user settings needed by compilation +#----------------------------------------------------------------------------- +SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +CONFIGURE_FILE (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) + +INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) +INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR}) + +# -------------------------------------------------------------------- +# Macro used to add a unit test +# -------------------------------------------------------------------- +MACRO (HL_ADD_TEST hl_name files) + ADD_EXECUTABLE (hl_${hl_name} ${hl_name}.c) + H5_NAMING (hl_${hl_name}) + TARGET_LINK_LIBRARIES (hl_${hl_name} + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ) + + ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>) + + #-- Copy the necessary files. + FOREACH (h5_file ${files}) + SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}") + #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}") + ADD_CUSTOM_COMMAND ( + TARGET hl_${hl_name} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest} + ) + + ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES}) +ENDMACRO (HL_ADD_TEST) + +HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5") +HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri") +HL_ADD_TEST (test_lite "dtype_file.txt") +HL_ADD_TEST (test_packet "") +HL_ADD_TEST (test_table "test_table_be.hdf5;test_table_cray.hdf5;test_table_le.hdf5") + +# -------------------------------------------------------------------- +# This executable is used to generate test files for the test_ds test. +# It should only be run during development when new test files are needed +# -------------------------------------------------------------------- +IF (NOT BUILD_SHARED_LIBS) + ADD_EXECUTABLE (hl_gen_test_ds gen_test_ds.c) + H5_NAMING (hl_gen_test_ds) + TARGET_LINK_LIBRARIES (hl_gen_test_ds + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ) +ENDIF (NOT BUILD_SHARED_LIBS) diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt new file mode 100644 index 0000000..5730205 --- /dev/null +++ b/hl/tools/CMakeLists.txt @@ -0,0 +1,55 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_TOOLS) + +#----------------------------------------------------------------------------- +# Define Sources +#----------------------------------------------------------------------------- +SET (GIF2H5_SRCS + ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif.h + ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/decompress.c + ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif2hdf.c + ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif2mem.c + ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gifread.c + ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/writehdf.c +) + +#-- Add gif2hdf5 program +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5) + +ADD_EXECUTABLE (gif2h5 ${GIF2H5_SRCS}) +H5_NAMING (gif2h5) +TARGET_LINK_LIBRARIES (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + +#-- Add h52gif program +SET (hdf2gif_SRCS + ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/hdf2gif.c + ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/hdfgifwr.c +) +ADD_EXECUTABLE (hdf2gif ${hdf2gif_SRCS}) +H5_NAMING (hdf2gif) +TARGET_LINK_LIBRARIES (hdf2gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + +# -------------------------------------------------------------------- +# This executable can generate the actual test files - Currently not +# used in the CMake Build system as we rely on the test files that are +# shipped with HDF5 source archives +# -------------------------------------------------------------------- +IF (NOT BUILD_SHARED_LIBS) + ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) + H5_NAMING (hl_h52gifgentest) + TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + +# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) +ENDIF (NOT BUILD_SHARED_LIBS) + +#----------------------------------------------------------------------------- +# Add file(s) to CMake Install +#----------------------------------------------------------------------------- +INSTALL ( + TARGETS + gif2h5 + hdf2gif + RUNTIME DESTINATION + bin/tools +) |