From 13426d47feb8b5d417c83a1b38de08fff66cf1e0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Aug 2011 10:11:10 -0500 Subject: [svn-r21263] Add F2003 support to CMake builds --- CMakeLists.txt | 1 + config/cmake/HDF5UseFortran.cmake | 9 +++++++++ config/cmake/cacheinit.cmake | 2 ++ config/cmake/hdf5-config.cmake.build.in | 1 + config/cmake/hdf5-config.cmake.install.in | 1 + fortran/src/CMakeLists.txt | 20 ++++++++++++++++++++ 6 files changed, 34 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d46aeee..5e5f8bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -700,6 +700,7 @@ SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") IF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") OPTION (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) IF (HDF5_BUILD_FORTRAN) + OPTION (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" OFF) INCLUDE (${HDF5_RESOURCES_DIR}/HDF5UseFortran.cmake) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran) IF (HDF5_BUILD_HL_LIB) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 1f429f5..c1c5acb 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -110,6 +110,15 @@ CHECK_FORTRAN_FEATURE(RealIsNotDouble FORTRAN_DEFAULT_REAL_NOT_DOUBLE ) +CHECK_FORTRAN_FEATURE(iso_c_binding + " + PROGRAM main + USE iso_c_binding + END PROGRAM + " + FORTRAN_HAVE_ISO_C_BINDING +) + #----------------------------------------------------------------------------- # Add debug information (intel Fortran : JB) #----------------------------------------------------------------------------- diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 6293c35..d6c8fbc 100755 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -14,6 +14,8 @@ SET (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) SET (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) +SET (HDF5_ENABLE_F2003 OFF CACHE BOOL "Enable FORTRAN 2003 Standard" FORCE) + SET (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE) SET (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE) diff --git a/config/cmake/hdf5-config.cmake.build.in b/config/cmake/hdf5-config.cmake.build.in index 35090fc..ccf5e67 100644 --- a/config/cmake/hdf5-config.cmake.build.in +++ b/config/cmake/hdf5-config.cmake.build.in @@ -8,6 +8,7 @@ GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) #----------------------------------------------------------------------------- SET (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) +SET (HDF5_ENABLE_F2003 @HDF5_ENABLE_F2003@) SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) diff --git a/config/cmake/hdf5-config.cmake.install.in b/config/cmake/hdf5-config.cmake.install.in index 189a66c..22ce5f3 100644 --- a/config/cmake/hdf5-config.cmake.install.in +++ b/config/cmake/hdf5-config.cmake.install.in @@ -11,6 +11,7 @@ GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) #----------------------------------------------------------------------------- SET (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) +SET (HDF5_ENABLE_F2003 @HDF5_ENABLE_F2003@) SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index e2da265..bb927eb 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -120,6 +120,17 @@ SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} ${LIB_TYPE}) #----------------------------------------------------------------------------- +# Fortran 2003 standard +#----------------------------------------------------------------------------- +IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) + # default real is 4 bytes, so include double signatures + SET (F_STATUS "_F03") +ELSE (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) + # default real is 8 bytes, so exclude double signatures + SET (F_STATUS "_F90") +ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) + +#----------------------------------------------------------------------------- # Fortran Real Size #----------------------------------------------------------------------------- IF (FORTRAN_DEFAULT_REAL_NOT_DOUBLE) @@ -139,6 +150,7 @@ SET (f90_F_SRCS # normal distribution ${HDF5_F90_SRC_SOURCE_DIR}/H5f90global.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5_ff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5_ff.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Aff.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.f90 @@ -153,6 +165,14 @@ SET (f90_F_SRCS ${HDF5_F90_SRC_SOURCE_DIR}/H5Sff.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Tff.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Aff${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Eff${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Lff${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Off${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Rff${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Tff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5_DBLE_Interface${F_DBLE}.f90 ) -- cgit v0.12