diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2010-05-12 18:51:33 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2010-05-12 18:51:33 (GMT) |
commit | 84103cef854a758a8d5dcd270ba36e2495ed3282 (patch) | |
tree | f11548eec782a94edda60d2f78edb7f320d8b4c2 /hl/fortran | |
parent | 08ce72aebd7b8957a11c365f95b4bbded708e91f (diff) | |
download | hdf5-84103cef854a758a8d5dcd270ba36e2495ed3282.zip hdf5-84103cef854a758a8d5dcd270ba36e2495ed3282.tar.gz hdf5-84103cef854a758a8d5dcd270ba36e2495ed3282.tar.bz2 |
[svn-r18773] Add files to support building library with CMake
Tested: Local linux
Diffstat (limited to 'hl/fortran')
-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/test/CMakeLists.txt | 70 |
4 files changed, 243 insertions, 0 deletions
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/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>) |