diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2016-09-21 15:58:20 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2016-09-21 15:58:20 (GMT) |
commit | f240c5c4221473f6172c6c869bcb268cf7b36da3 (patch) | |
tree | 2c832446f20bbb2553ab25df48a60ccf09989ac5 | |
parent | 5f13efeb79e09c2f84dde4f74d3a1d115a865145 (diff) | |
parent | bc1d833a80190a83bb11151f2d60035acdae3d2c (diff) | |
download | hdf5-f240c5c4221473f6172c6c869bcb268cf7b36da3.zip hdf5-f240c5c4221473f6172c6c869bcb268cf7b36da3.tar.gz hdf5-f240c5c4221473f6172c6c869bcb268cf7b36da3.tar.bz2 |
Merge pull request #37 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop
* commit 'bc1d833a80190a83bb11151f2d60035acdae3d2c':
Fix typo
Add missing SH to target name
Add gen file technique to HL and test fortran libraries
-rw-r--r-- | fortran/test/CMakeLists.txt | 69 | ||||
-rw-r--r-- | hl/fortran/src/CMakeLists.txt | 64 |
2 files changed, 99 insertions, 34 deletions
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index d1ca6e8..baf7369 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} @@ -118,6 +149,7 @@ if (WIN32) ) endif (WIN32) 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") @@ -327,6 +359,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 diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 6419ab8..ead8aec 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -37,6 +37,7 @@ set_target_properties (H5HL_buildiface PROPERTIES ) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + file (MAKE_DIRECTORY "${HDF5_HL_F90_SRC_BINARY_DIR}/shared") if (WIN32) set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE}) else (WIN32) @@ -111,30 +112,61 @@ set (HDF5_HL_F90_F_BASE_SOURCES ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTff.F90 ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.F90 ) -set (HDF5_HL_F90_F_SOURCES - ${HDF5_HL_F90_F_BASE_SOURCES} - # generated files - ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 - ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 +set (CMD $<TARGET_FILE:H5HL_buildiface>) +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 ${HDF5_HL_F90_F_BASE_SOURCES} + COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" +) +add_custom_target (H5HLgen ALL + DEPENDS ${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_SOURCES} PROPERTIES LANGUAGE Fortran) - set_source_files_properties ( ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 PROPERTIES GENERATED TRUE ) +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + set (CMDSH $<TARGET_FILE:H5HL_buildiface>) + add_custom_command ( + OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90 + COMMAND ${CMD} + WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR}/shared + DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} + COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files" + ) + add_custom_target (H5HLgenSH ALL + DEPENDS ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90 + ) + set_source_files_properties ( + ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 + ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90 + PROPERTIES GENERATED TRUE + ) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) -set (CMD $<TARGET_FILE:H5HL_buildiface>) -add_custom_target (H5HLgen ALL - COMMAND ${CMD} -#v3.2 BYPRODUCT ${HDF5_HL_F90_SRC_BINARY_DIR}/H5LTff_gen.F90 -#v3.2 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90 - WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR} - DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} +set (HDF5_HL_F90_F_SOURCES + ${HDF5_HL_F90_F_BASE_SOURCES} + + # 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_SOURCES} PROPERTIES LANGUAGE Fortran) + +if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) + set (HDF5_HL_F90_F_SOURCES_SHARED + ${HDF5_HL_F90_F_BASE_SOURCES} + + # generated files + ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 + ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90 + ) + set_source_files_properties (${HDF5_HL_F90_F_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) +endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} STATIC " " " ") @@ -155,7 +187,7 @@ endif (WIN32) set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) - add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES}) + add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED}) set (SHARED_LINK_FLAGS " ") if (WIN32 AND MSVC) set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") |