diff options
author | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2016-09-22 17:48:53 (GMT) |
---|---|---|
committer | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2016-09-22 17:48:53 (GMT) |
commit | 8eb76e1f65d029f7e651bc4ce2570a2fc31616ed (patch) | |
tree | 1de6301391274e13a1999874b4fa2d8a37037536 /fortran | |
parent | 392b8ce3c98ac4e52d53f33e591ed6bf14155925 (diff) | |
parent | be3ad22522825d170e50a513c2937ca69799d82a (diff) | |
download | hdf5-8eb76e1f65d029f7e651bc4ce2570a2fc31616ed.zip hdf5-8eb76e1f65d029f7e651bc4ce2570a2fc31616ed.tar.gz hdf5-8eb76e1f65d029f7e651bc4ce2570a2fc31616ed.tar.bz2 |
Merge branch 'develop' of ssh://bitbucket.hdfgroup.org:7999/~brtnfld/hdf5_msb into develop
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/CMakeLists.txt | 69 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 72 |
2 files changed, 108 insertions, 33 deletions
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index ea38c58..d4ca791 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -65,6 +65,7 @@ set_target_properties (H5_buildiface PROPERTIES ) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") if (WIN32) set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE}) else (WIN32) @@ -92,6 +93,8 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} DEPENDS H5match_types ) +set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5f90i_gen.h PROPERTIES GENERATED TRUE) +set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 PROPERTIES GENERATED TRUE) #----------------------------------------------------------------------------- # f90CStub lib @@ -114,7 +117,6 @@ set (f90CStub_C_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Tf.c ${HDF5_F90_SRC_SOURCE_DIR}/H5Zf.c ) - set_source_files_properties (${f90CStub_C_SOURCES} PROPERTIES LANGUAGE C) set (f90CStub_C_HDRS @@ -150,15 +152,43 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) set (install_targets ${install_targets} ${HDF5_F90_C_LIBSH_TARGET}) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5_gen.F90 PROPERTIES GENERATED TRUE) - #----------------------------------------------------------------------------- # Fortran Modules #----------------------------------------------------------------------------- -set (f90_F_BASE_SOURCES - # generated files - ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 +set (f90_F_GEN_SOURCES + ${HDF5_F90_SRC_SOURCE_DIR}/H5Aff.F90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90 +) +set (CMD $<TARGET_FILE:H5_buildiface>) +add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/H5_gen.F90 + COMMAND ${CMD} + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} + DEPENDS ${f90_F_GEN_SOURCES} + COMMENT "Generating the H5_gen.F90 file" +) +add_custom_target (H5gen ALL + DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90 +) +set_source_files_properties (${HDF5_F90_BINARY_DIR}/H5_gen.F90 PROPERTIES GENERATED TRUE) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + set (CMDSH $<TARGET_FILE:H5_buildiface>) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 + COMMAND ${CMDSH} + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared + DEPENDS ${f90_F_GEN_SOURCES} + COMMENT "Generating the H5_gen.F90 shared file" + ) + add_custom_target (H5genSH ALL + DEPENDS ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 PROPERTIES GENERATED TRUE) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + +set (f90_F_BASE_SOURCES # normal distribution ${HDF5_F90_SRC_SOURCE_DIR}/H5f90global.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5fortkit.F90 @@ -179,6 +209,9 @@ set (f90_F_BASE_SOURCES ) set (f90_F_SOURCES + # generated file + ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 + ${f90_F_BASE_SOURCES} # generated file @@ -187,16 +220,20 @@ set (f90_F_SOURCES # normal distribution ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 ) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + set (f90_F_SOURCES_SHARED + # generated file + ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 -set (CMD $<TARGET_FILE:H5_buildiface>) -add_custom_target (H5gen ALL - COMMAND ${CMD} -#v3.2 BYPRODUCT ${HDF5_F90_BINARY_DIR}/H5_gen.F90 - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} - DEPENDS ${f90_F_BASE_SOURCES} -) + ${f90_F_BASE_SOURCES} + + # generated file + ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 -set_source_files_properties (${f90_F_SOURCES} PROPERTIES LANGUAGE Fortran) + # normal distribution + ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 + ) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #----------------------------------------------------------------------------- # Add Main fortran library @@ -222,9 +259,10 @@ if (WIN32) ) endif (WIN32) set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) +add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES}) + add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED}) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") @@ -250,6 +288,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) endif (WIN32) set (install_targets ${install_targets} ${HDF5_F90_LIBSH_TARGET}) + add_dependencies(${HDF5_F90_LIBSH_TARGET} H5genSH) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #----------------------------------------------------------------------------- diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index d1ca6e8..219f937 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -32,13 +32,19 @@ set_target_properties (H5_test_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (NOT SKIP_HDF5_FORTRAN_SHARED) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") if (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE}) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE}) else (WIN32) - set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) + set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) endif (WIN32) -endif (NOT SKIP_HDF5_FORTRAN_SHARED) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +if (WIN32) + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE}) +else (WIN32) + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static) +endif (WIN32) INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR}) @@ -75,29 +81,54 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -set (HDF5_F90_TF_SOURCES - # generated files - ${HDF5_F90_BINARY_DIR}/tf_gen.F90 -) -set_source_files_properties ( - ${HDF5_F90_BINARY_DIR}/tf_gen.F90 - PROPERTIES GENERATED TRUE -) -set_source_files_properties (tf.F90 ${HDF5_F90_BINARY_DIR}/${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) - set (CMD $<TARGET_FILE:H5_test_buildiface>) -add_custom_target (H5testgen ALL +add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/tf_gen.F90 COMMAND ${CMD} -#v3.2 BYPRODUCT ${HDF5_F90_BINARY_DIR}/tf_gen.F90 WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} DEPENDS H5_test_buildiface + COMMENT "Generating the tf_gen.F90 file" ) +add_custom_target (H5testgen ALL + DEPENDS ${HDF5_F90_BINARY_DIR}/tf_gen.F90 +) +set_source_files_properties (${HDF5_F90_BINARY_DIR}/tf_gen.F90 PROPERTIES GENERATED TRUE) -add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC tf.F90 ${HDF5_F90_TF_SOURCES}) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED tf.F90 ${HDF5_F90_TF_SOURCES}) + set (CMDSH $<TARGET_FILE:H5_test_buildiface>) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 + COMMAND ${CMDSH} + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared + DEPENDS H5_test_buildiface + COMMENT "Generating the tf_gen.F90 shared file" + ) + add_custom_target (H5testgenSH ALL + DEPENDS ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + +set (HDF5_F90_TF_SOURCES + # generated files + ${HDF5_F90_BINARY_DIR}/tf_gen.F90 + + # normal distribution + tf.F90 +) +set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + set (HDF5_F90_TF_SOURCES_SHARED + # generated file + ${HDF5_F90_BINARY_DIR}/shared/tf_gen.F90 + + # normal distribution + tf.F90 + ) + set_source_files_properties (${HDF5_F90_TF_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) +add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_TARGET} @@ -117,7 +148,10 @@ if (WIN32) COMPILE_DEFINITIONS "HDF5F90_WINDOWS" ) endif (WIN32) +add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) + if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED}) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) set (SHARED_LINK_FLAGS "/DLL") @@ -143,6 +177,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) COMPILE_DEFINITIONS "BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS" ) endif (WIN32) + add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) #----------------------------------------------------------------------------- @@ -327,6 +362,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) if (WIN32 AND MSVC) target_link_libraries (fortranlib_test_F03-shared "ws2_32.lib") endif (WIN32 AND MSVC) + target_include_directories (fortranlib_test_F03-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran |