From b67a6727cf0c848f92463a15ac76a2fbdfc6555a Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 9 Jul 2015 10:01:11 -0500 Subject: [svn-r27359] Fixed Cmake to handle autogenerated Fortran HL APIs --- fortran/src/H5config_f.inc.cmake | 7 +++++++ fortran/src/H5config_f.inc.in | 3 +++ hl/fortran/src/CMakeLists.txt | 42 ++++++++++++++++++++++++++++++++++++++++ hl/fortran/test/tsttable.F90 | 4 ++-- 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index 2f987c3..cc36889 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -43,6 +43,13 @@ ! should this be ${HDF_PREFIX} instead of H5 MSB +#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ + +#if H5_SIZEOF_DOUBLE==0 +#undef H5_SIZEOF_DOUBLE +#endif + +! should this be ${HDF_PREFIX} instead of H5 MSB #define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ #if H5_SIZEOF_LONG_DOUBLE==0 diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index b0de405..64c3a0c 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -25,6 +25,9 @@ #undef HAVE_ISO_FORTRAN_ENV ! Define the size of C's long double +#undef SIZEOF_DOUBLE + +! Define the size of C's long double #undef SIZEOF_LONG_DOUBLE ! Define the maximum decimal precision for reals diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 4f266a4..85bc9b4 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -12,6 +12,40 @@ if (WIN32) endif (WIN32) #----------------------------------------------------------------------------- +# Generate the H5LT and H5TB REAL APIs +#----------------------------------------------------------------------------- + +add_executable (H5HL_buildiface + ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90 + ) + +if (WIN32 AND MSVC) + if (BUILD_SHARED_LIBS) + set_target_properties (H5HL_buildiface + PROPERTIES + COMPILE_FLAGS "/MT" + ) + endif (BUILD_SHARED_LIBS) + set_target_properties (H5HL_buildiface + PROPERTIES + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) +endif (WIN32 AND MSVC) +set_target_properties (H5HL_buildiface PROPERTIES + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} +) + +set (CMD $) +add_custom_command ( + OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 + ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 + COMMAND ${CMD} + WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR} + DEPENDS H5HL_buildiface +) + +#----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES ( @@ -54,6 +88,14 @@ set (HDF5_HL_F90_F_SRCS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTff.F90 ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.F90 ) +set (HDF5_HL_F90_F_SRCS + ${HDF5_HL_F90_F_SRCS} + + # generated files + ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 + ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 +) + set_source_files_properties (${HDF5_HL_F90_F_SRCS} PROPERTIES LANGUAGE Fortran) add_library (${HDF5_HL_F90_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_F_SRCS}) diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index f57f933..74029a5 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -82,9 +82,9 @@ SUBROUTINE test_table1() SIZEOF_X = SIZEOF(bufd(1)) #endif - ! If Fortran DOUBLE PRECISION and C DOUBLE sizeof don't match then disable + ! If Fortran DOUBLE PRECISION and C DOUBLE sizeofs don't match then disable ! creating a DOUBLE RECISION field, and instead create a REAL field. This - ! is to handle when DOUBLE PRECISION is promoted via a compiler option. + ! is needed to handle when DOUBLE PRECISION is promoted via a compiler flag. Exclude_double = .FALSE. IF(Cs_sizeof_double.NE.SIZEOF_X)THEN Exclude_double = .TRUE. -- cgit v0.12