diff options
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/Makefile.am | 17 | ||||
-rw-r--r-- | fortran/examples/CMakeLists.txt | 145 | ||||
-rw-r--r-- | fortran/examples/CMakeTests.cmake | 96 | ||||
-rw-r--r-- | fortran/src/CMakeLists.txt | 301 | ||||
-rw-r--r-- | fortran/src/H5Ff.c | 34 | ||||
-rw-r--r-- | fortran/src/H5Fff.F90 | 39 | ||||
-rw-r--r-- | fortran/src/H5Pff.F90 | 99 | ||||
-rw-r--r-- | fortran/src/H5Sf.c | 20 | ||||
-rw-r--r-- | fortran/src/H5Sff.F90 | 27 | ||||
-rw-r--r-- | fortran/src/H5VLff.F90 | 315 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 16 | ||||
-rw-r--r-- | fortran/src/H5_ff.F90 | 27 | ||||
-rw-r--r-- | fortran/src/H5f90global.F90 | 35 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 5 | ||||
-rw-r--r-- | fortran/src/HDF5.F90 | 1 | ||||
-rw-r--r-- | fortran/src/Makefile.am | 3 | ||||
-rw-r--r-- | fortran/src/hdf5_fortrandll.def.in | 11 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 502 | ||||
-rw-r--r-- | fortran/test/CMakeTests.cmake | 204 | ||||
-rw-r--r-- | fortran/test/Makefile.am | 3 | ||||
-rw-r--r-- | fortran/test/tH5F.F90 | 29 | ||||
-rw-r--r-- | fortran/test/tH5MISC_1_8.F90 | 33 | ||||
-rw-r--r-- | fortran/test/tH5O_F03.F90 | 2 | ||||
-rw-r--r-- | fortran/test/vol_connector.F90 | 284 | ||||
-rw-r--r-- | fortran/testpar/CMakeTests.cmake | 2 |
25 files changed, 1473 insertions, 777 deletions
diff --git a/fortran/Makefile.am b/fortran/Makefile.am index 38084b9..c07fa3e 100644 --- a/fortran/Makefile.am +++ b/fortran/Makefile.am @@ -22,14 +22,27 @@ include $(top_srcdir)/config/commence.am -if BUILD_PARALLEL_CONDITIONAL +if BUILD_TESTS_PARALLEL_CONDITIONAL TESTPARALLEL_DIR=testpar +else + TESTPARALLEL_DIR= +endif +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR=test +else + TESTSERIAL_DIR= endif # Subdirectories in build order, not including examples directory ## Only recurse into subdirectories if HDF5 is configured to use Fortran. if BUILD_FORTRAN_CONDITIONAL - SUBDIRS=src test $(TESTPARALLEL_DIR) + SUBDIRS=src $(TESTSERIAL_DIR) $(TESTPARALLEL_DIR) + +# Test with just the native connector, with a single pass-through connector +# and with a doubly-stacked pass-through. +VOL_LIST = native "pass_through under_vol=0;under_info={}" \ + "pass_through under_vol=505;under_info={under_vol=0;under_info={}}" + endif # All directories that have Makefiles diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 0c570c6..e8dddd3 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -35,56 +35,43 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f90_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) target_compile_options(f90_ex_${example} PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f90_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET f90_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> # ) # set_property(TARGET f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:> +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> # ) if(MSVC) set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f90_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f90_ex_${example}-shared + if (NOT BUILD_SHARED_LIBS) + target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(f90_ex_${example}-shared + target_link_libraries (f90_ex_${example} PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) + set_target_properties (f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (f90_ex_${example}-shared + else () + target_include_directories (f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) -# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f90_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f90_ex_${example}-shared PROPERTIES + set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared @@ -94,18 +81,10 @@ endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f03_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) target_compile_options(f03_ex_${example} PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f03_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET f03_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> # ) @@ -115,35 +94,30 @@ foreach (example ${F2003_examples}) if(MSVC) set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f03_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran03 - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f03_ex_${example}-shared + if (NOT ONLY_SHARED_LIBS) + target_include_directories (f03_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(f03_ex_${example}-shared + target_link_libraries (f03_ex_${example} PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - target_link_libraries (f03_ex_${example}-shared + set_target_properties (f03_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran03 + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (f03_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) -# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f03_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f03_ex_${example}-shared PROPERTIES + set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared @@ -153,19 +127,10 @@ endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_include_directories (f90_ex_ph5example - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" - ) target_compile_options(f90_ex_ph5example PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f90_ex_ph5example - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> - ) # set_property(TARGET f90_ex_ph5example APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> # ) @@ -175,36 +140,32 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) if(MSVC) set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f90_ex_ph5example PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_include_directories (f90_ex_ph5example-shared + if (NOT ONLY_SHARED_LIBS) + target_include_directories (f90_ex_ph5example PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" ) - target_compile_options(f90_ex_ph5example-shared + target_link_libraries (f90_ex_ph5example PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> + ) + set_target_properties (f90_ex_ph5example PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (f90_ex_ph5example + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" ) - target_link_libraries (f90_ex_ph5example-shared + target_link_libraries (f90_ex_ph5example PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> ) -# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f90_ex_ph5example-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f90_ex_ph5example-shared PROPERTIES + set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 323cf91..1ad606c 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -16,36 +16,7 @@ ############################################################################## ############################################################################## - # Remove any output file left over from previous test run - add_test ( - NAME f90_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - compound.h5 - copy1.h5 - copy2.h5 - dsetf.h5 - extend.h5 - FORTRAN.h5 - groupf.h5 - groupsf.h5 - h5_cmprss.h5 - mount1.h5 - mount2.h5 - sdsf.h5 - subset.h5 - SDScompound.h5 - test.h5 - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-clear-objects") - if (BUILD_SHARED_LIBS) - add_test ( - NAME f90_ex-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + set (test_CLEANFILES compound.h5 copy1.h5 copy2.h5 @@ -61,12 +32,18 @@ subset.h5 SDScompound.h5 test.h5 - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f90_ex-shared-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-shared-clear-objects") + ) + + # Remove any output file left over from previous test run + add_test ( + NAME f90_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${test_CLEANFILES} + ) + if (last_test) + set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif () + set (last_test "f90_ex-clear-objects") foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -83,30 +60,10 @@ foreach (example ${examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex_${example}") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f90_ex-shared_${example} COMMAND $<TARGET_FILE:f90_ex_${example}-shared>) - else () - add_test (NAME f90_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:f90_ex_${example}-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f90_ex_${example}-shared.txt" - #-D "TEST_REFERENCE=f90_ex_${example}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f90_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-shared_${example}") - endif () endforeach () foreach (example ${F2003_examples}) @@ -124,35 +81,12 @@ foreach (example ${F2003_examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f03_ex_${example}") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex-shared_${example} COMMAND $<TARGET_FILE:f03_ex_${example}-shared>) - else () - add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}-shared.txt" - #-D "TEST_REFERENCE=f03_ex_${example}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f03_ex-shared_${example}") - endif () endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) - add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS}) - if (BUILD_SHARED_LIBS) - add_test (NAME f90_ex-shared_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS}) - endif () + add_test (NAME MPI_TEST_f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS}) endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index f71e820..b01e4d4 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -40,7 +40,7 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID) #----------------------------------------------------------------------------- add_executable (H5_buildiface ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90) -target_include_directories(H5_buildiface +target_include_directories (H5_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}" ) @@ -69,24 +69,28 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +if (NOT ONLY_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +endif () #----------------------------------------------------------------------------- add_executable (H5match_types ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c ) -target_include_directories(H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - COMMAND $<TARGET_FILE:H5match_types> - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS H5match_types -) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +target_include_directories (H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + COMMAND $<TARGET_FILE:H5match_types> + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static + DEPENDS H5match_types + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h @@ -131,24 +135,26 @@ set (f90CStub_C_SHHDRS ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ) -add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) -target_include_directories(${HDF5_F90_C_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" -) -TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES - FOLDER libraries/fortran - LINKER_LANGUAGE C -) -set (install_targets ${HDF5_F90_C_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) + target_include_directories (${HDF5_F90_C_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + ) + TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES + FOLDER libraries/fortran + LINKER_LANGUAGE C + ) + set (install_targets ${HDF5_F90_C_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) - target_include_directories(${HDF5_F90_C_LIBSH_TARGET} + target_include_directories (${HDF5_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) @@ -174,17 +180,19 @@ set (f90_F_GEN_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90 ) -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - COMMAND $<TARGET_FILE:H5_buildiface> - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS ${f90_F_GEN_SOURCES} - COMMENT "Generating the H5_gen.F90 file" -) -add_custom_target (H5gen ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 -) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) +if (NOT ONLY_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + COMMAND $<TARGET_FILE:H5_buildiface> + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static + DEPENDS ${f90_F_GEN_SOURCES} + COMMENT "Generating the H5_gen.F90 file" + ) + add_custom_target (H5gen ALL + DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) +endif () if (BUILD_SHARED_LIBS) add_custom_command ( @@ -217,21 +225,24 @@ set (f90_F_BASE_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Rff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Sff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Tff.F90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5VLff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.F90 ) -set (f90_F_SOURCES - # generated file - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 +if (NOT ONLY_SHARED_LIBS) + set (f90_F_SOURCES + # generated file + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - ${f90_F_BASE_SOURCES} + ${f90_F_BASE_SOURCES} - # generated file - ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + # generated file + ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - # normal distribution - ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 -) + # normal distribution + ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 + ) +endif () if (BUILD_SHARED_LIBS) set (f90_F_SOURCES_SHARED # generated file @@ -250,43 +261,45 @@ endif () #----------------------------------------------------------------------------- # Add Main fortran library #----------------------------------------------------------------------------- -add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) -target_include_directories (${HDF5_F90_LIB_TARGET} - PRIVATE - "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" -) -target_compile_definitions(${HDF5_F90_LIB_TARGET} - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS> - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (${HDF5_F90_LIB_TARGET} - PUBLIC - ${HDF5_F90_C_LIB_TARGET} - PRIVATE - ${LINK_Fortran_LIBS} - $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> -) -#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -#) -if(MSVC) - set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES - FOLDER libraries/fortran - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") -set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) -add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) + target_include_directories (${HDF5_F90_LIB_TARGET} + PRIVATE + "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + ) + target_compile_definitions(${HDF5_F90_LIB_TARGET} + PRIVATE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS> + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (${HDF5_F90_LIB_TARGET} + PUBLIC + ${HDF5_F90_C_LIB_TARGET} + PRIVATE + ${LINK_Fortran_LIBS} + $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> + ) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES + FOLDER libraries/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") + set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) + add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED}) @@ -351,35 +364,38 @@ install ( fortheaders ) -set (mod_files - ${MOD_BUILD_DIR}/h5fortran_types.mod - ${MOD_BUILD_DIR}/hdf5.mod - ${MOD_BUILD_DIR}/h5fortkit.mod - ${MOD_BUILD_DIR}/h5global.mod - ${MOD_BUILD_DIR}/h5a.mod - ${MOD_BUILD_DIR}/h5d.mod - ${MOD_BUILD_DIR}/h5e.mod - ${MOD_BUILD_DIR}/h5f.mod - ${MOD_BUILD_DIR}/h5g.mod - ${MOD_BUILD_DIR}/h5i.mod - ${MOD_BUILD_DIR}/h5l.mod - ${MOD_BUILD_DIR}/h5lib.mod - ${MOD_BUILD_DIR}/h5o.mod - ${MOD_BUILD_DIR}/h5p.mod - ${MOD_BUILD_DIR}/h5r.mod - ${MOD_BUILD_DIR}/h5s.mod - ${MOD_BUILD_DIR}/h5t.mod - ${MOD_BUILD_DIR}/h5z.mod - ${MOD_BUILD_DIR}/h5_gen.mod -) -install ( - FILES - ${mod_files} - DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR}/static - COMPONENT - fortheaders -) +if (NOT ONLY_SHARED_LIBS) + set (mod_files + ${MOD_BUILD_DIR}/h5fortran_types.mod + ${MOD_BUILD_DIR}/hdf5.mod + ${MOD_BUILD_DIR}/h5fortkit.mod + ${MOD_BUILD_DIR}/h5global.mod + ${MOD_BUILD_DIR}/h5a.mod + ${MOD_BUILD_DIR}/h5d.mod + ${MOD_BUILD_DIR}/h5e.mod + ${MOD_BUILD_DIR}/h5f.mod + ${MOD_BUILD_DIR}/h5g.mod + ${MOD_BUILD_DIR}/h5i.mod + ${MOD_BUILD_DIR}/h5l.mod + ${MOD_BUILD_DIR}/h5lib.mod + ${MOD_BUILD_DIR}/h5o.mod + ${MOD_BUILD_DIR}/h5p.mod + ${MOD_BUILD_DIR}/h5r.mod + ${MOD_BUILD_DIR}/h5s.mod + ${MOD_BUILD_DIR}/h5t.mod + ${MOD_BUILD_DIR}/h5vl.mod + ${MOD_BUILD_DIR}/h5z.mod + ${MOD_BUILD_DIR}/h5_gen.mod + ) + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/static + COMPONENT + fortheaders + ) +endif () if (BUILD_SHARED_LIBS) set (modsh_files @@ -400,6 +416,7 @@ if (BUILD_SHARED_LIBS) ${MODSH_BUILD_DIR}/h5r.mod ${MODSH_BUILD_DIR}/h5s.mod ${MODSH_BUILD_DIR}/h5t.mod + ${MODSH_BUILD_DIR}/h5vl.mod ${MODSH_BUILD_DIR}/h5z.mod ${MODSH_BUILD_DIR}/h5_gen.mod ) @@ -421,8 +438,10 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) #INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) endif () - INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) - #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + endif () install ( TARGETS @@ -436,3 +455,53 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_F90_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +set (_PKG_CONFIG_LIBS_PRIVATE) + +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_F90_LIB_CORENAME}") +endif () +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_F90_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}") + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT fortlibraries +) + +if (NOT WIN32) + set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5fc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5fc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT fortlibraries + ) +endif () + + diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index a4e786e..12fb7ed 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -632,6 +632,40 @@ done: return ret_value; } +/****if* H5Ff/h5fget_fileno_c + * NAME + * h5fget_fileno_c + * PURPOSE + * Call H5Fget_fileno to get file number + * INPUTS + * file_id - file identifier + * OUTPUTS + * fileno - file number for open file + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * Quincey Koziol + * Saturday, April 13, 2019 + * SOURCE +*/ +int_f +h5fget_fileno_c(hid_t_f *file_id, int_f *fileno) +/******/ +{ + unsigned long fileno_c; + herr_t ret_value=0; /* Return value */ + + /* + * Call H5Fget_filesize function + */ + if ((ret_value = H5Fget_fileno((hid_t)*file_id, &fileno_c)) < 0) + HGOTO_DONE(FAIL); + *fileno = (hsize_t_f)fileno_c; + +done: + return ret_value; +} + /****if* H5Ff/h5fget_file_image_c * NAME * h5fget_file_image_c diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index cc51f37..8574c06 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -591,7 +591,6 @@ CONTAINS ! is an HDF5 file INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER(HID_T) :: access_prp_default CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name INTEGER(C_INT) :: flag ! "TRUE/FALSE/ERROR" flag from C routine ! to define status value. @@ -886,6 +885,44 @@ CONTAINS hdferr = h5fget_filesize_c(file_id, size) END SUBROUTINE h5fget_filesize_f +!****s* H5F/h5fget_fileno_f +! +! NAME +! h5fget_fileno_f +! +! PURPOSE +! Retrieves the file number of the HDF5 file. +! +! INPUTS +! file_id - file identifier +! OUTPUTS +! fileno - file number +! hdferr - Returns 0 if successful and -1 if fails +! +! AUTHOR +! Quincey Koziol +! April 13, 2019 +! +! SOURCE + SUBROUTINE h5fget_fileno_f(file_id, fileno, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: file_id ! file identifier + INTEGER, INTENT(OUT) :: fileno ! File number + INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success, + ! -1 if fail +!***** + INTERFACE + INTEGER FUNCTION h5fget_fileno_c(file_id, fileno) & + BIND(C,NAME='h5fget_fileno_c') + IMPORT :: HID_T, HSIZE_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: file_id + INTEGER, INTENT(OUT) :: fileno + END FUNCTION h5fget_fileno_c + END INTERFACE + hdferr = h5fget_fileno_c(file_id, fileno) + END SUBROUTINE h5fget_fileno_f + !****s* H5F (F03)/h5fget_file_image_f_F03 ! ! NAME diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 13a2953..0c0500d 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -9,7 +9,7 @@ ! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. *S +! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * ! * ! This file is part of HDF5. The full HDF5 copyright notice, including * @@ -7929,7 +7929,7 @@ SUBROUTINE h5pget_virtual_filename_f(dcpl_id, index, name, hdferr, name_len) INTERFACE INTEGER(SIZE_T) FUNCTION h5pget_virtual_filename(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_filename') - IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPORT :: HID_T, SIZE_T, C_PTR IMPLICIT NONE INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id INTEGER(SIZE_T), INTENT(IN), VALUE :: index @@ -7997,7 +7997,7 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) INTERFACE INTEGER(SIZE_T) FUNCTION h5pget_virtual_dsetname(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_dsetname') - IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPORT :: HID_T, SIZE_T, C_PTR IMPLICIT NONE INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id INTEGER(SIZE_T), INTENT(IN), VALUE :: index @@ -8018,7 +8018,6 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) ELSE CALL HD5c2fstring(name,c_name,LEN(name)) ENDIF - ENDIF END SUBROUTINE h5pget_virtual_dsetname_f @@ -8115,5 +8114,97 @@ END SUBROUTINE h5pget_virtual_dsetname_f END SUBROUTINE h5pset_dset_no_attrs_hint_f +!****s* H5P/H5Pset_vol_f +! +! NAME +! H5Pset_vol_f +! +! PURPOSE +! Set the file VOL connector (VOL_ID) for a file access +! property list (PLIST_ID) +! INPUTS +! plist_id - access property list identifier. +! new_vol_id - VOL connector id. +! +! OUTPUTS +! hdferr - error code: +! 0 on success and -1 on failure +! +! OPTIONAL +! new_vol_info - VOL connector info. +! +! AUTHOR +! M.S. Breitenfeld +! May 2019 +! +! Fortran Interface: + SUBROUTINE h5pset_vol_f(plist_id, new_vol_id, hdferr, new_vol_info) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + INTEGER(HID_T) , INTENT(IN) :: new_vol_id + INTEGER , INTENT(OUT) :: hdferr + TYPE(C_PTR) , OPTIONAL :: new_vol_info +!***** + + TYPE(C_PTR) :: new_vol_info_default + + INTERFACE + INTEGER FUNCTION h5pset_vol(plist_id, new_vol_id, new_vol_info) BIND(C, NAME='H5Pset_vol') + IMPORT :: HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: plist_id + INTEGER(HID_T), INTENT(IN), VALUE :: new_vol_id + TYPE(C_PTR) , INTENT(IN), VALUE :: new_vol_info + END FUNCTION h5pset_vol + END INTERFACE + + new_vol_info_default = C_NULL_PTR + IF(PRESENT(new_vol_info)) new_vol_info_default=new_vol_info + + hdferr = INT(h5pset_vol(plist_id, new_vol_id, new_vol_info_default)) + + END SUBROUTINE h5pset_vol_f + +!****s* H5P/H5Pget_vol_id_f +! +! NAME +! H5Pget_vol_id_f +! +! PURPOSE +! Get the file VOL connector (VOL_ID) for a file access +! property list (PLIST_ID) +! INPUTS +! plist_id - access property list identifier. +! +! OUTPUTS +! vol_id - VOL connector id. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! M.S. Breitenfeld +! May 2019 +! +! Fortran Interface: + SUBROUTINE h5pget_vol_id_f(plist_id, vol_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + INTEGER(HID_T) , INTENT(OUT) :: vol_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5pget_vol_id(plist_id, vol_id) BIND(C, NAME='H5Pget_vol_id') + IMPORT :: HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: plist_id + INTEGER(HID_T), INTENT(OUT) :: vol_id + END FUNCTION h5pget_vol_id + END INTERFACE + + hdferr = INT(h5pget_vol_id(plist_id, vol_id)) + + END SUBROUTINE h5pget_vol_id_f + END MODULE H5P diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 2eae0d9..1031914 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -994,8 +994,6 @@ done: return ret_value; } - -#ifdef NEW_HYPERSLAB_API /****if* H5Sf/h5scombine_hyperslab_c * NAME * h5scombine_hyperslab_c @@ -1119,11 +1117,11 @@ h5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_ ret_value = 0; return ret_value; } -/****if* H5Sf/h5sselect_select_c +/****if* H5Sf/h5smodify_select_c * NAME - * h5sselect_select_c + * h5smodify_select_c * PURPOSE - * Call H5Sselect_ select + * Call H5Smodify_select * INPUTS * space1_id - identifier of the first dataspace to modify * operator - defines how the new selection is combined @@ -1139,7 +1137,7 @@ h5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_ */ int_f -h5sselect_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id) +h5smodify_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id) /******/ { int ret_value = -1; @@ -1151,11 +1149,11 @@ h5sselect_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id) c_space1_id = (hid_t)*space1_id; c_space2_id = (hid_t)*space2_id; - if( H5Sselect_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value; + if( H5Smodify_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value; ret_value = 0; return ret_value; } -#endif /*NEW_HYPERSLAB_API*/ + /****if* H5Sf/h5sget_select_type_c * NAME * h5sget_select_type_c @@ -1310,7 +1308,7 @@ h5sdecode_c ( _fcd buf, hid_t_f *obj_id ) */ int_f -h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) +h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id ) /******/ { int ret_value = -1; @@ -1323,7 +1321,7 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) if (*nalloc == 0) { - if(H5Sencode((hid_t)*obj_id, c_buf, &c_size) < 0) + if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0) return ret_value; *nalloc = (size_t_f)c_size; @@ -1341,7 +1339,7 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ) /* * Call H5Sencode function. */ - if(H5Sencode((hid_t)*obj_id, c_buf, &c_size) < 0){ + if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0){ return ret_value; } diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index 3434fba..e6f8e4c 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -1506,7 +1506,7 @@ CONTAINS ! !$!****s* H5S/ ! !$! ! !$! NAME -! !$! h5sselect_select_f +! !$! h5smodify_select_f ! !$! ! !$! PURPOSE ! !$! Refine a hyperslab selection with an operation @@ -1543,7 +1543,7 @@ CONTAINS ! !$! ! ! SOURCE -! SUBROUTINE h5sselect_select_f(space1_id, operator, space2_id, & +! SUBROUTINE h5smodify_select_f(space1_id, operator, space2_id, & ! hdferr) ! IMPLICIT NONE ! INTEGER(HID_T), INTENT(INOUT) :: space1_id ! Dataspace identifier to @@ -1563,22 +1563,22 @@ CONTAINS ! INTEGER, INTENT(OUT) :: hdferr ! Error code ! INTERFACE -! INTEGER FUNCTION h5sselect_select_c(space1_id, operator, & +! INTEGER FUNCTION h5smodify_select_c(space1_id, operator, & ! space2_id) ! USE H5GLOBAL ! !DEC$IF DEFINED(HDF5F90_WINDOWS) -! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SSELECT_SELECT_C'::h5sselect_select_c +! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SMODIFY_SELECT_C'::h5smodify_select_c ! !DEC$ENDIF ! INTEGER(HID_T), INTENT(INOUT) :: space1_id ! INTEGER(HID_T), INTENT(IN) :: space2_id ! INTEGER, INTENT(IN) :: operator -! END FUNCTION h5sselect_select_c +! END FUNCTION h5smodify_select_c ! END INTERFACE -! hdferr = h5sselect_select_c(space1_id, operator, space2_id) +! hdferr = h5smodify_select_c(space1_id, operator, space2_id) ! return -! END SUBROUTINE h5sselect_select_f +! END SUBROUTINE h5smodify_select_f ! !****s* H5S/h5sget_select_type_f @@ -1683,25 +1683,32 @@ CONTAINS ! M. Scot Breitenfeld ! March 26, 2008 ! SOURCE - SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr) + SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr, fapl_id) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: obj_id CHARACTER(LEN=*), INTENT(OUT) :: buf INTEGER(SIZE_T), INTENT(INOUT) :: nalloc INTEGER, INTENT(OUT) :: hdferr + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: fapl_id ! File access property list !***** + INTEGER(HID_T) :: fapl_id_default INTERFACE - INTEGER FUNCTION h5sencode_c(buf, obj_id, nalloc) BIND(C,NAME='h5sencode_c') + INTEGER FUNCTION h5sencode_c(buf, obj_id, nalloc, fapl_id_default) BIND(C,NAME='h5sencode_c') IMPORT :: C_CHAR IMPORT :: HID_T, SIZE_T INTEGER(HID_T), INTENT(IN) :: obj_id CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: buf INTEGER(SIZE_T), INTENT(INOUT) :: nalloc + INTEGER(HID_T) :: fapl_id_default END FUNCTION h5sencode_c END INTERFACE - hdferr = h5sencode_c(buf, obj_id, nalloc) + fapl_id_default = H5P_DEFAULT_F + + IF(PRESENT(fapl_id)) fapl_id_default = fapl_id + + hdferr = h5sencode_c(buf, obj_id, nalloc, fapl_id_default) END SUBROUTINE h5sencode_f diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 new file mode 100644 index 0000000..e21f38f --- /dev/null +++ b/fortran/src/H5VLff.F90 @@ -0,0 +1,315 @@ +!****h* ROBODoc/H5VL +! +! NAME +! MODULE H5VL +! +! PURPOSE +! This file contains Fortran interfaces for H5VL (VOL) functions. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the COPYING file, which can be found at the root of the source code * +! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * +! If you do not have access to either file, you may request a copy from * +! help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! _____ __ __ _____ ____ _____ _______ _ _ _______ +! |_ _| \/ | __ \ / __ \| __ \__ __|/\ | \ | |__ __| +! **** | | | \ / | |__) | | | | |__) | | | / \ | \| | | | **** +! **** | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | | **** +! **** _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | | **** +! |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_| +! +! If you add a new H5VL function you must add the function name to the +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. +! This is needed for Windows based operating systems. +! +!***** + +MODULE H5VL + + USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_FUNPTR, C_CHAR, C_INT64_T, C_INT + USE H5GLOBAL + USE H5fortkit + + IMPLICIT NONE + +CONTAINS + +! H5VLregister_connector + +! +!****s* H5VL/H5VLregister_connector_by_name_f +! +! NAME +! H5VLregister_connector_by_name_f +! +! PURPOSE +! Registers a new VOL connector as a member of the virtual object +! layer class by name. +! +! INPUTS +! name - Connector name +! OUTPUTS +! vol_id - VOL id +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLregister_connector_by_name_f(name, vol_id, hdferr, vipl_id) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(HID_T) :: vipl_id_default + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLregister_connector_by_name(name, vipl_id) & + BIND(C,NAME='H5VLregister_connector_by_name') + IMPORT :: C_CHAR + IMPORT :: HID_T + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id + END FUNCTION H5VLregister_connector_by_name + END INTERFACE + + vipl_id_default = H5P_DEFAULT_F + IF(PRESENT(vipl_id)) vipl_id_default = vipl_id + + c_name = TRIM(name)//C_NULL_CHAR + vol_id = H5VLregister_connector_by_name(c_name, vipl_id_default) + + hdferr = 0 + IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F + + END SUBROUTINE H5VLregister_connector_by_name_f + + SUBROUTINE H5VLregister_connector_by_value_f(connector_value, vol_id, hdferr, vipl_id) + IMPLICIT NONE + INTEGER, INTENT(IN) :: connector_value + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id +!***** + INTEGER(HID_T) :: vipl_id_default + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLregister_connector_by_value(connector_value, vipl_id) & + BIND(C,NAME='H5VLregister_connector_by_value') + IMPORT :: HID_T + IMPORT :: C_INT + INTEGER(C_INT), VALUE :: connector_value + INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id + END FUNCTION H5VLregister_connector_by_value + END INTERFACE + + vipl_id_default = H5P_DEFAULT_F + IF(PRESENT(vipl_id)) vipl_id_default = vipl_id + + vol_id = H5VLregister_connector_by_value(INT(connector_value,C_INT), vipl_id_default) + + hdferr = 0 + IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F + + END SUBROUTINE H5VLregister_connector_by_value_f + +! +!****s* H5VL/H5VLis_connector_registered_f +! +! NAME +! H5VLis_connector_registered_f +! +! PURPOSE +! Tests whether a VOL class has been registered or not. +! +! INPUTS +! name - Connector name +! OUTPUTS +! registered - state of VOL class registration +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLis_connector_registered_f(name, registered, hdferr) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + LOGICAL, INTENT(OUT) :: registered + INTEGER, INTENT(OUT) :: hdferr +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(C_INT) :: registered_c + + INTERFACE + INTEGER(C_INT) FUNCTION H5VLis_connector_registered(name) BIND(C,NAME='H5VLis_connector_registered') + IMPORT :: C_CHAR + IMPORT :: C_INT + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + END FUNCTION H5VLis_connector_registered + END INTERFACE + + c_name = TRIM(name)//C_NULL_CHAR + registered_c = H5VLis_connector_registered(c_name) + + hdferr = 0 + registered = .FALSE. + IF(registered_c .GT. 0) registered = .TRUE. + IF(registered_c .LT. 0) hdferr = INT(registered_c) + + END SUBROUTINE H5VLis_connector_registered_f + +! +!****s* H5VL/H5VLis_connector_registered_f +! +! NAME +! H5VLis_connector_registered_f +! +! PURPOSE +! Retrieves the ID for a registered VOL connector. +! +! INPUTS +! name - Connector name +! OUTPUTS +! vol_id - Connector id +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLget_connector_id_f(name, vol_id, hdferr) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLget_connector_id(name) BIND(C,NAME='H5VLget_connector_id') + IMPORT :: C_CHAR + IMPORT :: HID_T + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + END FUNCTION H5VLget_connector_id + END INTERFACE + + c_name = TRIM(name)//C_NULL_CHAR + vol_id = H5VLget_connector_id(c_name) + + IF(vol_id.LT.0)THEN + hdferr = -1 + vol_id = H5I_INVALID_HID_F + ENDIF + + END SUBROUTINE H5VLget_connector_id_f + + SUBROUTINE H5VLget_connector_name_f(obj_id, name, hdferr, name_len) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL :: name_len +!***** + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name + INTEGER(SIZE_T) :: l + + INTERFACE + INTEGER(SIZE_T) FUNCTION H5VLget_connector_name(obj_id, name, size) BIND(C,NAME='H5VLget_connector_name') + IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: obj_id + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name + ! TYPE(C_PTR), value :: name + INTEGER(SIZE_T), INTENT(IN), VALUE :: size + END FUNCTION H5VLget_connector_name + END INTERFACE + + hdferr = 0 + IF(PRESENT(name_len))THEN + c_name(1:1)(1:1) = C_NULL_CHAR + name_len = INT(H5VLget_connector_name(obj_id, c_name, 1_SIZE_T), SIZE_T) + IF(name_len.LT.0) hdferr = H5I_INVALID_HID_F + ELSE + l = INT(LEN(name)+1,SIZE_T) + IF(INT(H5VLget_connector_name(obj_id, c_name, l), SIZE_T).LT.0)THEN + hdferr = H5I_INVALID_HID_F + ELSE + CALL HD5c2fstring(name,c_name,LEN(name)) + ENDIF + ENDIF + + END SUBROUTINE H5VLget_connector_name_f + +! +! +!****s* H5VL/H5VLclose_f +! +! NAME +! H5VLclose_f +! +! PURPOSE +! Closes a VOL connector ID. +! +! INPUTS +! vol_id - A valid identifier of the connectory to unregister. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLclose_f(vol_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: vol_id + INTEGER, INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION H5VLclose(vol_id) BIND(C, NAME='H5VLclose') + IMPORT :: HID_T + INTEGER(HID_T), INTENT(IN), VALUE :: vol_id + END FUNCTION H5VLclose + END INTERFACE + + hdferr = INT(H5VLclose(vol_id)) + + END SUBROUTINE H5VLclose_f + +! +!****s* H5VL/H5VLunregister_connector_f +! +! NAME +! H5VLunregister_connector_f +! +! PURPOSE +! Removes a VOL connector ID from the library. +! +! INPUTS +! plugin_id - A valid identifier of the connector to unregister. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLunregister_connector_f(plugin_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: plugin_id + INTEGER, INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION H5VLunregister_connector(plugin_id) BIND(C, NAME='H5VLunregister_connector') + IMPORT :: HID_T + INTEGER(HID_T), INTENT(IN), VALUE :: plugin_id + END FUNCTION H5VLunregister_connector + END INTERFACE + + hdferr = INT(H5VLunregister_connector(plugin_id)) + + END SUBROUTINE H5VLunregister_connector_f + +END MODULE H5VL diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 69ba8b3..2d1c6e7 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -498,6 +498,16 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5i_flags[4] = (int_f)H5I_DATASET; h5i_flags[5] = (int_f)H5I_ATTR; h5i_flags[6] = (int_f)H5I_BADID; + h5i_flags[7] = (int_f)H5I_UNINIT; + h5i_flags[8] = (int_f)H5I_VFL; + h5i_flags[9] = (int_f)H5I_VOL; + h5i_flags[10] = (int_f)H5I_GENPROP_CLS; + h5i_flags[11] = (int_f)H5I_GENPROP_LST; + h5i_flags[12] = (int_f)H5I_ERROR_CLASS; + h5i_flags[13] = (int_f)H5I_ERROR_MSG; + h5i_flags[14] = (int_f)H5I_ERROR_STACK; + h5i_flags[15] = (int_f)H5I_NTYPES; + h5i_flags[16] = (int_f)H5I_INVALID_HID; /* * H5L flags */ @@ -632,7 +642,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5s_flags[15] = (int_f)H5S_SEL_POINTS; h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS; h5s_flags[17] = (int_f)H5S_SEL_ALL; - /* * H5T flags */ @@ -671,7 +680,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5t_flags[32] = (int_f)H5T_ARRAY; h5t_flags[33] = (int_f)H5T_DIR_ASCEND; h5t_flags[34] = (int_f)H5T_DIR_DESCEND; - /* * H5Z flags */ @@ -695,10 +703,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5z_flags[17] = (int_f)H5Z_SO_FLOAT_ESCALE; h5z_flags[18] = (int_f)H5Z_SO_INT; h5z_flags[19] = (int_f)H5Z_SO_INT_MINBITS_DEFAULT; -/* - * H5A flags - */ - /* * H5 Generic flags introduced in version 1.8 diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 84529e4..443be79 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -88,7 +88,7 @@ MODULE H5LIB ! ! H5I flags declaration ! - INTEGER, PARAMETER :: H5I_FLAGS_LEN = 7 + INTEGER, PARAMETER :: H5I_FLAGS_LEN = 17 INTEGER, DIMENSION(1:H5I_FLAGS_LEN) :: H5I_flags ! ! H5L flags declaration @@ -129,6 +129,7 @@ MODULE H5LIB ! INTEGER, PARAMETER :: H5T_FLAGS_LEN = 35 INTEGER, DIMENSION(1:H5T_FLAGS_LEN) :: H5T_flags + ! ! H5Z flags declaration ! @@ -443,13 +444,23 @@ CONTAINS ! ! H5I flags declaration ! - H5I_FILE_F = H5I_flags(1) - H5I_GROUP_F = H5I_flags(2) - H5I_DATATYPE_F = H5I_flags(3) - H5I_DATASPACE_F = H5I_flags(4) - H5I_DATASET_F = H5I_flags(5) - H5I_ATTR_F = H5I_flags(6) - H5I_BADID_F = H5I_flags(7) + H5I_FILE_F = H5I_flags(1) + H5I_GROUP_F = H5I_flags(2) + H5I_DATATYPE_F = H5I_flags(3) + H5I_DATASPACE_F = H5I_flags(4) + H5I_DATASET_F = H5I_flags(5) + H5I_ATTR_F = H5I_flags(6) + H5I_BADID_F = H5I_flags(7) + H5I_UNINIT_F = H5I_flags(8) + H5I_VFL_F = H5I_flags(9) + H5I_VOL_F = H5I_flags(10) + H5I_GENPROP_CLS_F = H5I_flags(11) + H5I_GENPROP_LST_F = H5I_flags(12) + H5I_ERROR_CLASS_F = H5I_flags(13) + H5I_ERROR_MSG_F = H5I_flags(14) + H5I_ERROR_STACK_F = H5I_flags(15) + H5I_NTYPES_F = H5I_flags(16) + H5I_INVALID_HID_F = H5I_flags(17) ! ! H5L flags ! diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index b705cc1..02e3bc3 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -435,15 +435,36 @@ MODULE H5GLOBAL !DEC$ATTRIBUTES DLLEXPORT :: H5I_DATASET_F !DEC$ATTRIBUTES DLLEXPORT :: H5I_ATTR_F !DEC$ATTRIBUTES DLLEXPORT :: H5I_BADID_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_UNINIT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_VFL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_VOL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_GENPROP_CLS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_GENPROP_LST_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_CLASS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_MSG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_STACK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_NTYPES_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_INVALID_HID_F !DEC$endif - INTEGER :: H5I_FILE_F - INTEGER :: H5I_GROUP_F - INTEGER :: H5I_DATATYPE_F - INTEGER :: H5I_DATASPACE_F - INTEGER :: H5I_DATASET_F - INTEGER :: H5I_ATTR_F - INTEGER :: H5I_BADID_F + INTEGER :: H5I_FILE_F + INTEGER :: H5I_GROUP_F + INTEGER :: H5I_DATATYPE_F + INTEGER :: H5I_DATASPACE_F + INTEGER :: H5I_DATASET_F + INTEGER :: H5I_ATTR_F + INTEGER :: H5I_BADID_F + INTEGER :: H5I_UNINIT_F + INTEGER :: H5I_VFL_F + INTEGER :: H5I_VOL_F + INTEGER :: H5I_GENPROP_CLS_F + INTEGER :: H5I_GENPROP_LST_F + INTEGER :: H5I_ERROR_CLASS_F + INTEGER :: H5I_ERROR_MSG_F + INTEGER :: H5I_ERROR_STACK_F + INTEGER :: H5I_NTYPES_F + INTEGER :: H5I_INVALID_HID_F + ! ! H5L flags declaration ! diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 56b7f22..5faf4b4 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -91,6 +91,7 @@ H5_FCDLL int_f h5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *bu H5_FCDLL int_f h5fflush_c(hid_t_f *obj_id, int_f *scope); H5_FCDLL int_f h5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen); H5_FCDLL int_f h5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size); +H5_FCDLL int_f h5fget_fileno_c(hid_t_f *file_id, int_f *fileno); /* * Functions from H5Sf.c @@ -122,9 +123,9 @@ H5_FCDLL int_f h5sget_select_type_c( hid_t_f *space_id , int_f *op); H5_FCDLL int_f h5sselect_elements_c( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord); H5_FCDLL int_f h5scombine_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id); H5_FCDLL int_f h5scombine_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id); -H5_FCDLL int_f h5sselect_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id); +H5_FCDLL int_f h5smodify_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id); H5_FCDLL int_f h5sdecode_c( _fcd buf, hid_t_f *obj_id ); -H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc ); +H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id ); H5_FCDLL int_f h5sextent_equal_c( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal); /* diff --git a/fortran/src/HDF5.F90 b/fortran/src/HDF5.F90 index 0370224..fe38b7d 100644 --- a/fortran/src/HDF5.F90 +++ b/fortran/src/HDF5.F90 @@ -38,6 +38,7 @@ MODULE HDF5 USE H5O USE H5P USE H5R + USE H5VL USE H5Z USE H5_gen USE H5LIB diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 666f6cb..4009439 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -44,7 +44,7 @@ endif libhdf5_fortran_la_SOURCES=H5f90global.F90 \ H5fortran_types.F90 H5_ff.F90 H5Aff.F90 H5Dff.F90 H5Eff.F90 \ H5Fff.F90 H5Gff.F90 H5Iff.F90 H5Lff.F90 H5Off.F90 H5Pff.F90 H5Rff.F90 H5Sff.F90 \ - H5Tff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \ + H5Tff.F90 H5VLff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c HDF5.F90 @@ -155,6 +155,7 @@ H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo +H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.F90 H5f90global.lo H5_gen.lo: H5_gen.F90 H5f90global.lo H5Aff.lo H5Dff.lo H5Pff.lo HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \ diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index a99efad..e31a582 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -98,6 +98,7 @@ H5F_mp_H5FGET_ACCESS_PLIST_F H5F_mp_H5FIS_ACCESSIBLE_F H5F_mp_H5FIS_HDF5_F H5F_mp_H5FGET_NAME_F +H5F_mp_H5FGET_FILENO_F H5F_mp_H5FGET_FILESIZE_F H5F_mp_H5FGET_FILE_IMAGE_F H5F_mp_H5FGET_DSET_NO_ATTRS_HINT_F @@ -334,6 +335,8 @@ H5P_mp_H5PGET_VIRTUAL_FILENAME_F H5P_mp_H5PGET_VIRTUAL_DSETNAME_F H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F +H5P_mp_H5PSET_VOL_F +H5P_mp_H5PGET_VOL_ID_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F @@ -451,6 +454,14 @@ H5T_mp_H5TGET_NATIVE_TYPE_F H5T_mp_H5TCONVERT_F H5T_mp_H5TENUM_INSERT_F90 H5T_mp_H5TENUM_INSERT_F03 +; H5VL +H5VL_mp_H5VLREGISTER_CONNECTOR_BY_NAME_F +H5VL_mp_H5VLREGISTER_CONNECTOR_BY_VALUE_F +H5VL_mp_H5VLIS_CONNECTOR_REGISTERED_F +H5VL_mp_H5VLGET_CONNECTOR_ID_F +H5VL_mp_H5VLGET_CONNECTOR_NAME_F +H5VL_mp_H5VLCLOSE_F +H5VL_mp_H5VLUNREGISTER_CONNECTOR_F ; H5Z H5Z_mp_H5ZUNREGISTER_F H5Z_mp_H5ZFILTER_AVAIL_F diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index b862fcd..9c68860 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -7,7 +7,7 @@ project (HDF5_FORTRAN_TESTS C Fortran) #----------------------------------------------------------------------------- add_executable (H5_test_buildiface ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90) -target_include_directories(H5_test_buildiface +target_include_directories (H5_test_buildiface PRIVATE ${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR} ) @@ -31,35 +31,37 @@ set_target_properties (H5_test_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +else () file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- # Add Test Lib #----------------------------------------------------------------------------- -add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) -set_source_files_properties (t.c PROPERTIES LANGUAGE C) -target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" -) -TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE - ${HDF5_F90_C_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} -) -H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES - FOLDER libraries/test/fortran - LINKER_LANGUAGE C -) -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) + set_source_files_properties (t.c PROPERTIES LANGUAGE C) + target_include_directories (${HDF5_F90_C_TEST_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + ) + TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} + PRIVATE ${HDF5_F90_C_LIB_TARGET} + PUBLIC ${HDF5_TEST_LIB_TARGET} + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES + FOLDER libraries/test/fortran + LINKER_LANGUAGE C + ) +else () add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) - target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} + target_include_directories (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) @@ -67,9 +69,9 @@ if (BUILD_SHARED_LIBS) PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" ) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED) - target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE - ${HDF5_F90_C_LIBSH_TARGET} - ${HDF5_TEST_LIBSH_TARGET} + target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} + PRIVATE ${HDF5_F90_C_LIBSH_TARGET} + PUBLIC ${HDF5_TEST_LIBSH_TARGET} ) H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} SHARED "F") set_target_properties (${HDF5_F90_C_TEST_LIBSH_TARGET} PROPERTIES @@ -78,19 +80,19 @@ if (BUILD_SHARED_LIBS) ) endif () -add_custom_command ( - OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - COMMAND $<TARGET_FILE:H5_test_buildiface> - WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static - DEPENDS H5_test_buildiface - COMMENT "Generating the tf_gen.F90 file" -) -add_custom_target (H5testgen ALL - DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 -) -set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) - -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + COMMAND $<TARGET_FILE:H5_test_buildiface> + WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static + DEPENDS H5_test_buildiface + COMMENT "Generating the tf_gen.F90 file" + ) + add_custom_target (H5testgen ALL + DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + ) + set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) +else () add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 COMMAND $<TARGET_FILE:H5_test_buildiface> @@ -104,15 +106,16 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) endif () -set (HDF5_F90_TF_SOURCES - # generated files - ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 +if (NOT BUILD_SHARED_LIBS) + set (HDF5_F90_TF_SOURCES + # generated files + ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - # normal distribution - tf.F90 -) -set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) -if (BUILD_SHARED_LIBS) + # normal distribution + tf.F90 + ) + set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) +else () set (HDF5_F90_TF_SOURCES_SHARED # generated file ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 @@ -123,40 +126,40 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_F90_TF_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) endif () -add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) -target_include_directories (${HDF5_F90_TEST_LIB_TARGET} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - INTERFACE - "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" -) -target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS> - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} - PUBLIC - ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} -) -#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -#) -if(MSVC) - set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES - FOLDER libraries/test/fortran - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) -add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) - -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) + target_include_directories (${HDF5_F90_TEST_LIB_TARGET} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE + "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + ) + target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} + PRIVATE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS> + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} + PUBLIC + ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES + FOLDER libraries/test/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) + add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) +else () add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED}) target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} PRIVATE @@ -218,18 +221,10 @@ add_executable (testhdf5_fortran tH5Z.F90 tHDF5.F90 ) -target_include_directories (testhdf5_fortran - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(testhdf5_fortran PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (testhdf5_fortran - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> -) #set_property(TARGET testhdf5_fortran APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> #) @@ -239,58 +234,36 @@ target_link_libraries (testhdf5_fortran if(MSVC) set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (testhdf5_fortran PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (testhdf5_fortran-shared - fortranlib_test.F90 - tH5A.F90 - tH5D.F90 - tH5E.F90 - tH5F.F90 - tH5G.F90 - tH5I.F90 - tH5P.F90 - tH5R.F90 - tH5S.F90 - tH5Sselect.F90 - tH5T.F90 - tH5VL.F90 - tH5Z.F90 - tHDF5.F90 - ) - target_include_directories (testhdf5_fortran-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (testhdf5_fortran PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(testhdf5_fortran-shared + target_link_libraries (testhdf5_fortran PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> + ) + set_target_properties (testhdf5_fortran PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (testhdf5_fortran + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_link_libraries (testhdf5_fortran-shared + target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) -# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET testhdf5_fortran-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (testhdf5_fortran-shared PROPERTIES + set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for testhdf5_fortran_1_8 @@ -302,18 +275,10 @@ add_executable (testhdf5_fortran_1_8 tH5MISC_1_8.F90 tHDF5_1_8.F90 ) -target_include_directories (testhdf5_fortran_1_8 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(testhdf5_fortran_1_8 PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (testhdf5_fortran_1_8 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> -) #set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> #) @@ -323,49 +288,36 @@ target_link_libraries (testhdf5_fortran_1_8 if(MSVC) set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (testhdf5_fortran_1_8 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (testhdf5_fortran_1_8-shared - fortranlib_test_1_8.F90 - tH5O.F90 - tH5A_1_8.F90 - tH5G_1_8.F90 - tH5MISC_1_8.F90 - tHDF5_1_8.F90 - ) - target_include_directories (testhdf5_fortran_1_8-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (testhdf5_fortran_1_8 PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(testhdf5_fortran_1_8-shared + target_link_libraries (testhdf5_fortran_1_8 PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> + ) + set_target_properties (testhdf5_fortran_1_8 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (testhdf5_fortran_1_8-shared + add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (testhdf5_fortran_1_8 + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) -# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET testhdf5_fortran_1_8-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES + set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fortranlib_test_F03 @@ -379,18 +331,10 @@ add_executable (fortranlib_test_F03 tH5T_F03.F90 tHDF5_F03.F90 ) -target_include_directories (fortranlib_test_F03 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(fortranlib_test_F03 PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fortranlib_test_F03 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> -) #set_property(TARGET fortranlib_test_F03 APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> #) @@ -400,67 +344,44 @@ target_link_libraries (fortranlib_test_F03 if(MSVC) set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fortranlib_test_F03 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fortranlib_test_F03-shared - fortranlib_test_F03.F90 - tH5E_F03.F90 - tH5F_F03.F90 - tH5L_F03.F90 - tH5O_F03.F90 - tH5P_F03.F90 - tH5T_F03.F90 - tHDF5_F03.F90 - ) - target_include_directories (fortranlib_test_F03-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fortranlib_test_F03 PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(fortranlib_test_F03-shared + target_link_libraries (fortranlib_test_F03 PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> + ) + set_target_properties (fortranlib_test_F03 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fortranlib_test_F03 + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_link_libraries (fortranlib_test_F03-shared + target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) -# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fortranlib_test_F03-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fortranlib_test_F03-shared PROPERTIES + set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fflush1 add_executable (fflush1 fflush1.F90) -target_include_directories (fflush1 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) target_compile_options(fflush1 PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fflush1 - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> -) #set_property(TARGET fflush1 APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> #) @@ -470,58 +391,44 @@ target_link_libraries (fflush1 if(MSVC) set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fflush1 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fflush1-shared fflush1.F90) - target_include_directories (fflush1-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fflush1 PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_compile_options(fflush1-shared + target_link_libraries (fflush1 PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> + ) + set_target_properties (fflush1 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (fflush1-shared + add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fflush1 + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) -# set_property(TARGET fflush1-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fflush1-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fflush1-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fflush1-shared PROPERTIES + set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (fflush1 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fflush2 add_executable (fflush2 fflush2.F90) -target_include_directories (fflush2 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) target_compile_options (fflush2 PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fflush2 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> -) #set_property(TARGET fflush2 APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> #) @@ -531,42 +438,83 @@ target_link_libraries (fflush2 if(MSVC) set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fflush2 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fflush2-shared fflush2.F90) - target_include_directories (fflush2-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fflush2 PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_compile_options(fflush2-shared + target_link_libraries (fflush2 PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> + ) + set_target_properties (fflush2 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fflush2 + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - target_link_libraries (fflush2-shared + target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) -# set_property(TARGET fflush2-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fflush2-shared APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fflush2-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fflush2-shared PROPERTIES + set_target_properties (fflush2 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + add_dependencies (fflush2 ${HDF5_F90_TEST_LIBSH_TARGET}) +endif () + +#-- Adding test for vol_connector +add_executable (vol_connector vol_connector.F90) +target_compile_options(vol_connector + PRIVATE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> +) +#set_property(TARGET vol_connector APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET vol_connector APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET vol_connector PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") +endif() +if (NOT BUILD_SHARED_LIBS) + target_include_directories (vol_connector + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + target_link_libraries (vol_connector + PRIVATE + ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> + ) + set_target_properties (vol_connector PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (vol_connector ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (vol_connector + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + target_link_libraries (vol_connector + PRIVATE + ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> + ) + set_target_properties (vol_connector PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (vol_connector ${HDF5_F90_TEST_LIBSH_TARGET}) endif () include (CMakeTests.cmake) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 2824ef7..20fb7e3 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -15,50 +15,51 @@ ### T E S T I N G ### ############################################################################## ############################################################################## -if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fshared") -endif () + +set (test_CLEANFILES + a.h5 + b.h5 + c.h5 + d.h5 + dsetf_F03.h5 + enum1.h5 + extern_1a.raw + extern_2a.raw + extern_3a.raw + extern_4a.raw + extren_raw.raw + get_info.h5 + nbit.h5 + t_array_F03.h5 + t_bit_F03.h5 + t_controlchar_F03.h5 + t_enum_F03.h5 + t_objref_F03.h5 + t_opaque_F03.h5 + t_regref_F03.h5 + t_string_F03.h5 + t_vlen_F03.h5 + t_vlstring_F03.h5 + t_vlstringrw_F03.h5 + tarray1.h5 + tarray2.h5 + tarray3.h5 + test_create.h5 + tget_file_image.h5 + th5o_ref.h5 + titerate.h5 + vds.h5 + visit.h5 +) # Remove any output file left over from previous test run add_test ( NAME FORTRAN_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - a.h5 - b.h5 - c.h5 - d.h5 - dsetf_F03.h5 - enum1.h5 - extern_1a.raw - extern_2a.raw - extern_3a.raw - extern_4a.raw - extren_raw.raw - get_info.h5 - nbit.h5 - t_array_F03.h5 - t_bit_F03.h5 - t_controlchar_F03.h5 - t_enum_F03.h5 - t_objref_F03.h5 - t_opaque_F03.h5 - t_regref_F03.h5 - t_string_F03.h5 - t_vlen_F03.h5 - t_vlstring_F03.h5 - t_vlstringrw_F03.h5 - tarray1.h5 - tarray2.h5 - tarray3.h5 - test_create.h5 - tget_file_image.h5 - th5o_ref.h5 - titerate.h5 - vds.h5 - visit.h5 + ${test_CLEANFILES} ) -if (NOT "${last_test}" STREQUAL "") +if (last_test) set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "FORTRAN_testhdf5-clear-objects") @@ -122,6 +123,24 @@ endif () # set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) +#-- Adding test for vol_connector +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_vol_connector COMMAND $<TARGET_FILE:vol_connector>) +else () + add_test (NAME FORTRAN_vol_connector COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:vol_connector>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=vol_connector.txt" + #-D "TEST_REFERENCE=vol_connector.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () + #-- Adding test for fflush1 add_test (NAME FORTRAN_fflush1 COMMAND $<TARGET_FILE:fflush1>) set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) @@ -129,114 +148,3 @@ set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear- #-- Adding test for fflush2 add_test (NAME FORTRAN_fflush2 COMMAND $<TARGET_FILE:fflush2>) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) - -if (BUILD_SHARED_LIBS) - add_test ( - NAME FORTRAN_testhdf5-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - a.h5 - b.h5 - c.h5 - d.h5 - dsetf_F03.h5 - enum1.h5 - extern_1a.raw - extern_2a.raw - extern_3a.raw - extern_4a.raw - extren_raw.raw - get_info.h5 - nbit.h5 - t_array_F03.h5 - t_bit_F03.h5 - t_controlchar_F03.h5 - t_enum_F03.h5 - t_objref_F03.h5 - t_opaque_F03.h5 - t_regref_F03.h5 - t_string_F03.h5 - t_vlen_F03.h5 - t_vlstring_F03.h5 - t_vlstringrw_F03.h5 - tarray1.h5 - tarray2.h5 - tarray3.h5 - test_create.h5 - tget_file_image.h5 - th5o_ref.h5 - titerate.h5 - vds.h5 - visit.h5 - WORKING_DIRECTORY - ${PROJECT_BINARY_DIR}/fshared - ) - set_tests_properties (FORTRAN_testhdf5-shared-clear-objects PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND $<TARGET_FILE:testhdf5_fortran-shared>) - else () - add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5_fortran-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=testhdf5_fortran.txt" - #-D "TEST_REFERENCE=testhdf5_fortran.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES DEPENDS "FORTRAN_testhdf5_fortran;FORTRAN_testhdf5-shared-clear-objects") - - #-- Adding test for testhdf5_fortran_1_8 - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND $<TARGET_FILE:testhdf5_fortran_1_8-shared>) - else () - add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5_fortran_1_8-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=testhdf5_fortran_1_8.txt" - #-D "TEST_REFERENCE=testhdf5_fortran_1_8.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) - - #-- Adding test for fortranlib_test_F03 - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $<TARGET_FILE:fortranlib_test_F03-shared>) - else () - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=fortranlib_test_F03.txt" - #-D "TEST_REFERENCE=fortranlib_test_F03.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) - - #-- Adding test for fflush1 - add_test (NAME FORTRAN_fflush1-shared COMMAND $<TARGET_FILE:fflush1-shared>) - set_tests_properties (FORTRAN_fflush1-shared PROPERTIES DEPENDS FORTRAN_fflush2) - - #-- Adding test for fflush2 - add_test (NAME FORTRAN_fflush2-shared COMMAND $<TARGET_FILE:fflush2-shared>) - set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared) -endif () diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 8613cf9..f0d7f03 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -35,7 +35,7 @@ else endif # Our main targets, the tests themselves -TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 +TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 vol_connector check_PROGRAMS=$(TEST_PROG) @@ -50,6 +50,7 @@ fortranlib_test_1_8_SOURCES = tH5O.F90 tH5A_1_8.F90 tH5G_1_8.F90 tH5MISC_1_8.F90 fortranlib_test_F03_SOURCES = tH5E_F03.F90 tH5F_F03.F90 tH5L_F03.F90 \ tH5O_F03.F90 tH5P_F03.F90 tH5T_F03.F90 tHDF5_F03.F90 fortranlib_test_F03.F90 +vol_connector_SOURCES=vol_connector.F90 fflush1_SOURCES=fflush1.F90 fflush2_SOURCES=fflush2.F90 diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index 2501996..b898c21 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -105,6 +105,10 @@ CONTAINS INTEGER(SIZE_T) :: obj_count INTEGER(HID_T) :: t1, t2, t3, t4 + ! File numbers + INTEGER :: file_num1 + INTEGER :: file_num2 + ! !data buffers ! @@ -287,6 +291,18 @@ CONTAINS IF(obj_count.NE.2)THEN total_error = total_error + 1 ENDIF + + ! + !Check file numbers + ! + CALL h5fget_fileno_f(file1_id, file_num1, error) + CALL check("h5fget_fileno_f",error,total_error) + CALL h5fget_fileno_f(file2_id, file_num2, error) + CALL check("h5fget_fileno_f",error,total_error) + IF(file_num1 .EQ. file_num2) THEN + write(*,*) "file numbers aren't supposed to match" + END IF + ! !mount the second file under the first file's "/G" group. ! @@ -431,6 +447,8 @@ CONTAINS INTEGER, DIMENSION(4,6) :: dset_data, data_out INTEGER(HSIZE_T), DIMENSION(2) :: data_dims INTEGER(HSIZE_T) :: file_size + INTEGER :: file_num1 + INTEGER :: file_num2 CHARACTER(LEN=80) :: file_name INTEGER(SIZE_T) :: name_size @@ -499,6 +517,17 @@ CONTAINS CALL check("h5fget_filesize_f",error,total_error) ! + !Check file numbers + ! + CALL h5fget_fileno_f(file_id, file_num1, error) + CALL check("h5fget_fileno_f",error,total_error) + CALL h5fget_fileno_f(reopen_id, file_num2, error) + CALL check("h5fget_fileno_f",error,total_error) + IF(file_num1 .NE. file_num2) THEN + write(*,*) "file numbers don't match" + END IF + + ! !Open the dataset based on the reopen_id. ! CALL h5dopen_f(reopen_id, dsetname, dset_id, error) diff --git a/fortran/test/tH5MISC_1_8.F90 b/fortran/test/tH5MISC_1_8.F90 index 79fbf3e..b8c777c 100644 --- a/fortran/test/tH5MISC_1_8.F90 +++ b/fortran/test/tH5MISC_1_8.F90 @@ -189,8 +189,9 @@ SUBROUTINE test_h5s_encode(total_error) INTEGER(hid_t) :: sid1, sid3! Dataspace ID INTEGER(hid_t) :: decoded_sid1, decoded_sid3 + INTEGER(hid_t) :: fapl ! File access property INTEGER :: rank ! LOGICAL rank of dataspace - INTEGER(size_t) :: sbuf_size=0, scalar_size=0 + INTEGER(size_t) :: new_size = 0, old_size = 0, orig_size=0, scalar_size=0 ! Make sure the size is large CHARACTER(LEN=288) :: sbuf @@ -228,18 +229,36 @@ SUBROUTINE test_h5s_encode(total_error) ! Encode simple data space in a buffer - ! First find the buffer size - CALL H5Sencode_f(sid1, sbuf, sbuf_size, error) - CALL check("H5Sencode", error, total_error) + ! Find the buffer size without fapl + CALL H5Sencode_f(sid1, sbuf, orig_size, error) + CALL check("H5Sencode_f", error, total_error) + CALL verify("H5Sencode_f", INT(orig_size), 279, total_error) + + ! Create file access property list + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f", error, total_error) + + ! Find the buffer size with fapl (default old format) + CALL H5Sencode_f(sid1, sbuf, old_size, error, fapl) + CALL check("H5Sencode_f", error, total_error) + CALL verify("H5Sencode_f", INT(old_size), 279, total_error) + ! Set fapl to latest file format + CALL H5Pset_libver_bounds_f(fapl, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error) + CALL check("H5Pset_libver_bounds_f",error, total_error) - ! Try decoding bogus buffer + ! Find the buffer size with fapl set to latest format + CALL H5Sencode_f(sid1, sbuf, new_size, error, fapl) + CALL check("H5Sencode_f", error, total_error) + CALL verify("H5Sencode_f", INT(new_size), 101, total_error) + ! Try decoding bogus buffer CALL H5Sdecode_f(sbuf, decoded_sid1, error) CALL verify("H5Sdecode", error, -1, total_error) - CALL H5Sencode_f(sid1, sbuf, sbuf_size, error) - CALL check("H5Sencode", error, total_error) + ! Encode according to the latest file format + CALL H5Sencode_f(sid1, sbuf, new_size, error, fapl) + CALL check("H5Sencode_f", error, total_error) ! Decode from the dataspace buffer and return an object handle CALL H5Sdecode_f(sbuf, decoded_sid1, error) diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index d1a9ddb..78b6453 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -270,8 +270,6 @@ CONTAINS ! A(8) = tm_yday int days since January 1 0-365 ! A(9) = tm_isdst int Daylight Saving Time flag ! - INTEGER(C_INT), DIMENSION(:), POINTER :: c_atime, c_btime, c_ctime, c_mtime - INTEGER(C_INT), DIMENSION(1:8) :: atime, btime, ctime, mtime INTEGER :: len, i INTEGER :: idx INTEGER :: ierr diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 new file mode 100644 index 0000000..aabb2b8 --- /dev/null +++ b/fortran/test/vol_connector.F90 @@ -0,0 +1,284 @@ +!****h* root/fortran/test/vol_connector.F90 +! +! NAME +! vol_connector.F90 +! +! FUNCTION +! +! Tests basic Fortran VOL plugin operations (registration, etc.). +! Uses the null VOL connector (built with the testing code) +! which is loaded as a dynamic plugin. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the COPYING file, which can be found at the root of the source code * +! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * +! If you do not have access to either file, you may request a copy from * +! help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +!***** + +MODULE VOL_TMOD + + USE HDF5 + USE TH5_MISC + USE TH5_MISC_GEN + IMPLICIT NONE + + INTEGER, PARAMETER :: NATIVE_VOL_CONNECTOR_VALUE = 0 + CHARACTER(LEN=180) :: NATIVE_VOL_CONNECTOR_NAME + +CONTAINS + + !------------------------------------------------------------------------- + ! Function: test_registration_by_name() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by name. + ! + !------------------------------------------------------------------------- + ! + + SUBROUTINE test_registration_by_name(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 + CHARACTER(LEN=64) :: name + CHARACTER(LEN=1) :: name_null + INTEGER(SIZE_T) :: name_len + INTEGER(hid_t) :: file_id + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + ! Register the connector by name + CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) + CALL check("H5VLregister_connector_by_name_f",error,total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL check("H5VLget_connector_id_f",error,total_error) + + CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error) + CALL check("H5F_create_f",error,total_error) + + CALL H5VLget_connector_name_f(file_id, name, error, name_len) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error) + + CALL H5VLget_connector_name_f(file_id, name, error) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", TRIM(name), NATIVE_VOL_CONNECTOR_NAME, total_error) + + CALL H5VLget_connector_name_f(file_id, name_null, error, name_len) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error) + + CALL H5VLget_connector_name_f(file_id, name_null, error) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", name_null, NATIVE_VOL_CONNECTOR_NAME(1:1), total_error) + + CALL H5Fclose_f(file_id, error) + CALL check("H5Fclose_f",error,total_error) + + CALL H5VLclose_f(vol_id_out, error) + CALL check("H5VLclose_f",error, total_error) + + END SUBROUTINE test_registration_by_name + + !------------------------------------------------------------------------- + ! Function: test_registration_by_value() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by value. + ! + !------------------------------------------------------------------------- + + SUBROUTINE test_registration_by_value(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0 + + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + ! Register the connector by value + CALL H5VLregister_connector_by_value_f(NATIVE_VOL_CONNECTOR_VALUE, vol_id, error) + CALL check("H5VLregister_connector_by_value_f", error, total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + END SUBROUTINE test_registration_by_value + + + !------------------------------------------------------------------------- + ! Function: test_registration_by_name() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by name. + ! + !------------------------------------------------------------------------- + ! + + SUBROUTINE test_registration_by_fapl(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 + INTEGER(hid_t) :: file_id + INTEGER(hid_t) :: fapl_id + TYPE(C_PTR) :: f_ptr + + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) + CALL check("H5VLregister_connector_by_name_f",error,total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + ! Register the connector + CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_id, error) + CALL check("H5Pcreate_f",error,total_error) + + IF(TRIM(NATIVE_VOL_CONNECTOR_NAME) .EQ. "native")THEN + CALL H5Pset_vol_f(fapl_id, vol_id, error) + CALL check("H5Pset_vol_f",error,total_error) + + CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error) + CALL check("H5Pget_vol_id_f",error,total_error) + CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) + + f_ptr = C_NULL_PTR + CALL H5Pset_vol_f(fapl_id, vol_id, error, f_ptr) + CALL check("H5Pset_vol_f",error,total_error) + + CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error) + CALL check("H5Pget_vol_id_f",error,total_error) + CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) + ENDIF + + CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL check("H5VLget_connector_id_f",error,total_error) + CALL VERIFY("H5VLget_connector_id_f", vol_id_out, vol_id, total_error) + CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id) + + CALL check("H5F_create_f",error,total_error) + + CALL H5VLclose_f(vol_id_out, error) + CALL check("H5VLclose_f",error, total_error) + + CALL H5VLclose_f(vol_id, error) + CALL check("H5VLclose_f",error, total_error) + + CALL H5Fclose_f(file_id, error) + CALL check("H5Fclose_f",error,total_error) + + CALL H5Pclose_f(fapl_id, error) + CALL check("H5Pclose_f",error,total_error) + + END SUBROUTINE test_registration_by_fapl + + +END MODULE VOL_TMOD + + +PROGRAM vol_connector + + USE HDF5 + USE VOL_TMOD + + IMPLICIT NONE + INTEGER :: total_error = 0 + INTEGER :: error + INTEGER :: ret_total_error + LOGICAL :: cleanup, status + CHARACTER(LEN=12) :: VOL_CONNECTOR_ENV + INTEGER :: LEN = 0 + + CALL h5open_f(error) + cleanup = .TRUE. + CALL h5_env_nocleanup_f(status) + IF(status) cleanup=.FALSE. + + WRITE(*,'(18X,A)') '==============================' + WRITE(*,'(24X,A)') 'FORTRAN VOL tests' + WRITE(*,'(18X,A)') '==============================' + + WRITE(*,'(A)') "Testing VOL connector plugin functionality." + + ! Check to see if the VOL connector was set with an env variable + CALL GET_ENVIRONMENT_VARIABLE("HDF5_VOL_CONNECTOR", VOL_CONNECTOR_ENV, LEN) + IF(LEN.NE.0)THEN + NATIVE_VOL_CONNECTOR_NAME = TRIM(VOL_CONNECTOR_ENV) + ELSE + NATIVE_VOL_CONNECTOR_NAME = "native" + ENDIF + + ret_total_error = 0 + CALL test_registration_by_name(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by name', total_error) + + ret_total_error = 0 + CALL test_registration_by_value(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by value', total_error) + + ret_total_error = 0 + CALL test_registration_by_fapl(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by fapl', total_error) + + WRITE(*, fmt = '(/18X,A)') '============================================' + WRITE(*, fmt = '(19X, A)', advance='NO') ' FORTRAN VOL tests completed with ' + WRITE(*, fmt = '(I4)', advance='NO') total_error + WRITE(*, fmt = '(A)' ) ' error(s) ! ' + WRITE(*,'(18X,A)') '============================================' + + CALL h5close_f(error) + + ! if errors detected, exit with non-zero code. + IF (total_error .NE. 0) CALL h5_exit_f(1) + +END PROGRAM vol_connector diff --git a/fortran/testpar/CMakeTests.cmake b/fortran/testpar/CMakeTests.cmake index d00a6fc..d0abe0e 100644 --- a/fortran/testpar/CMakeTests.cmake +++ b/fortran/testpar/CMakeTests.cmake @@ -15,4 +15,4 @@ ### T E S T I N G ### ############################################################################## ############################################################################## -add_test (NAME FORT_parallel_test COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:parallel_test> ${MPIEXEC_POSTFLAGS}) +add_test (NAME MPI_TEST_FORT_parallel_test COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:parallel_test> ${MPIEXEC_POSTFLAGS}) |