summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/CMakeLists.txt50
-rw-r--r--fortran/test/CMakeLists.txt110
-rw-r--r--fortran/test/Makefile.am5
-rw-r--r--fortran/test/fortranlib_test.F902
-rw-r--r--fortran/testpar/hyper.f902
-rw-r--r--fortran/testpar/mdset.f902
-rw-r--r--fortran/testpar/ptest.f903
7 files changed, 118 insertions, 56 deletions
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index d97e625..dc884d5 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -66,19 +66,18 @@ set_target_properties (H5_buildiface PROPERTIES
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
if (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE})
+ set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/\${BUILD_TYPE})
else (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- endif (WIN32)
-else (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- if (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE})
- else (WIN32)
- set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+ set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
endif (WIN32)
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
+if (WIN32)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE})
+else (WIN32)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+endif (WIN32)
-INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR})
+INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY})
#-----------------------------------------------------------------------------
add_executable (H5match_types
@@ -292,11 +291,42 @@ install (
FILES
${mod_files}
DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}
+ ${HDF5_INSTALL_INCLUDE_DIR}/static
COMPONENT
fortheaders
)
+if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
+ set (modsh_files
+ ${MODSH_BUILD_DIR}/h5fortran_types.mod
+ ${MODSH_BUILD_DIR}/hdf5.mod
+ ${MODSH_BUILD_DIR}/h5global.mod
+ ${MODSH_BUILD_DIR}/h5a.mod
+ ${MODSH_BUILD_DIR}/h5d.mod
+ ${MODSH_BUILD_DIR}/h5e.mod
+ ${MODSH_BUILD_DIR}/h5f.mod
+ ${MODSH_BUILD_DIR}/h5g.mod
+ ${MODSH_BUILD_DIR}/h5i.mod
+ ${MODSH_BUILD_DIR}/h5l.mod
+ ${MODSH_BUILD_DIR}/h5lib.mod
+ ${MODSH_BUILD_DIR}/h5o.mod
+ ${MODSH_BUILD_DIR}/h5p.mod
+ ${MODSH_BUILD_DIR}/h5r.mod
+ ${MODSH_BUILD_DIR}/h5s.mod
+ ${MODSH_BUILD_DIR}/h5t.mod
+ ${MODSH_BUILD_DIR}/h5z.mod
+ ${MODSH_BUILD_DIR}/h5_gen.mod
+ )
+ install (
+ FILES
+ ${modsh_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}/shared
+ COMPONENT
+ fortheaders
+ )
+endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
+
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index 692cc4d..0cbd17f 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -7,6 +7,42 @@ PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran)
INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
#-----------------------------------------------------------------------------
+# Setup the Fortran auto-detection utilities
+# H5_test_buildiface.F90 used to generate various KIND test interfaces
+#-----------------------------------------------------------------------------
+
+add_executable (H5_test_buildiface
+ ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90
+ )
+
+if (WIN32 AND MSVC)
+ if (BUILD_SHARED_LIBS)
+ set_target_properties (H5_test_buildiface
+ PROPERTIES
+ COMPILE_FLAGS "/MT"
+ )
+ endif (BUILD_SHARED_LIBS)
+ set_target_properties (H5_test_buildiface
+ PROPERTIES
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+endif (WIN32 AND MSVC)
+set_target_properties (H5_test_buildiface PROPERTIES
+ LINKER_LANGUAGE Fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+)
+
+if (NOT SKIP_HDF5_FORTRAN_SHARED)
+ if (WIN32)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/\${BUILD_TYPE})
+ else (WIN32)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+ endif (WIN32)
+endif (NOT SKIP_HDF5_FORTRAN_SHARED)
+
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${MOD_BUILD_DIR})
+
+#-----------------------------------------------------------------------------
# Add Test Lib
#-----------------------------------------------------------------------------
add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c)
@@ -39,10 +75,27 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
)
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
-set_source_files_properties (tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90 PROPERTIES LANGUAGE Fortran)
-add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90)
+set (HDF5_F90_TF_SRCS
+ # generated files
+ ${HDF5_F90_BINARY_DIR}/tf_gen.F90
+)
+set_source_files_properties (
+ ${HDF5_F90_BINARY_DIR}/tf_gen.F90
+ PROPERTIES GENERATED TRUE
+)
+set_source_files_properties (tf.F90 ${HDF5_F90_BINARY_DIR}/${HDF5_F90_TF_SRCS} PROPERTIES LANGUAGE Fortran)
+
+set (CMD $<TARGET_FILE:H5_test_buildiface>)
+add_custom_target (H5testgen ALL
+ COMMAND ${CMD}
+#v3.2 BYPRODUCT ${HDF5_F90_BINARY_DIR}/tf_gen.F90
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
+ DEPENDS H5_test_buildiface
+)
+
+add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC tf.F90 ${HDF5_F90_TF_SRCS})
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED tf.F90 ${HDF5_F90_BINARY_DIR}/tf_gen.F90)
+ add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED tf.F90 ${HDF5_F90_TF_SRCS})
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC " " " ")
@@ -93,40 +146,6 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
#-----------------------------------------------------------------------------
-# Setup the Fortran auto-detection utilities
-# H5_test_buildiface.F90 used to generate various KIND test interfaces
-#-----------------------------------------------------------------------------
-
-add_executable (H5_test_buildiface
- ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90
- )
-
-if (WIN32 AND MSVC)
- if (BUILD_SHARED_LIBS)
- set_target_properties (H5_test_buildiface
- PROPERTIES
- COMPILE_FLAGS "/MT"
- )
- endif (BUILD_SHARED_LIBS)
- set_target_properties (H5_test_buildiface
- PROPERTIES
- LINK_FLAGS "/SUBSYSTEM:CONSOLE"
- )
-endif (WIN32 AND MSVC)
-set_target_properties (H5_test_buildiface PROPERTIES
- LINKER_LANGUAGE Fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
-)
-
-set (CMD $<TARGET_FILE:H5_test_buildiface>)
-add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/tf_gen.F90
- COMMAND ${CMD}
- WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
- DEPENDS H5_test_buildiface
-)
-
-#-----------------------------------------------------------------------------
# Add Tests
#-----------------------------------------------------------------------------
@@ -164,6 +183,8 @@ set_target_properties (testhdf5_fortran PROPERTIES
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
+add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET})
+
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (testhdf5_fortran-shared
fortranlib_test.F90
@@ -198,6 +219,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
+ add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
#-- Adding test for testhdf5_fortran_1_8
@@ -225,6 +247,8 @@ set_target_properties (testhdf5_fortran_1_8 PROPERTIES
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 AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (testhdf5_fortran_1_8-shared
fortranlib_test_1_8.F90
@@ -250,6 +274,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
+ add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
#-- Adding test for fortranlib_test_F03
@@ -279,6 +304,8 @@ set_target_properties (fortranlib_test_F03 PROPERTIES
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 AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (fortranlib_test_F03-shared
fortranlib_test_F03.F90
@@ -305,7 +332,8 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
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})
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
#-- Adding test for fflush1
@@ -326,6 +354,8 @@ set_target_properties (fflush1 PROPERTIES
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
+add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET})
+
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (fflush1-shared fflush1.F90)
TARGET_NAMING (fflush1-shared SHARED)
@@ -344,6 +374,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
+ add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
#-- Adding test for fflush2
@@ -364,6 +395,8 @@ set_target_properties (fflush2 PROPERTIES
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
+add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET})
+
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
add_executable (fflush2-shared fflush2.F90)
TARGET_NAMING (fflush2-shared SHARED)
@@ -382,6 +415,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
+ add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
include (CMakeTests.cmake)
diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am
index b0f85c5..60f9f53 100644
--- a/fortran/test/Makefile.am
+++ b/fortran/test/Makefile.am
@@ -43,11 +43,6 @@ check_PROGRAMS=$(TEST_PROG)
libh5test_fortran_la_SOURCES = tf_gen.F90 tf.F90 t.c
-# Source files are used for both the library and fortranlib_test.
-# Automake will complain about this without the following workaround.
-#fortranlib_test_FCFLAGS=$(AM_FCFLAGS)
-#fortranlib_test_CFLAGS=$(AM_CFLAGS)
-
fortranlib_test_SOURCES = tH5F.F90 tH5D.F90 tH5R.F90 tH5S.F90 tH5T.F90 tH5VL.F90 tH5Z.F90 \
tH5Sselect.F90 tH5P.F90 tH5A.F90 tH5I.F90 tH5G.F90 tH5E.F90 tHDF5.F90 fortranlib_test.F90
diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90
index c3e995b..2f88c45 100644
--- a/fortran/test/fortranlib_test.F90
+++ b/fortran/test/fortranlib_test.F90
@@ -24,6 +24,8 @@
!
!*****
+!#include <H5config_f.inc>
+
PROGRAM fortranlibtest
USE HDF5
diff --git a/fortran/testpar/hyper.f90 b/fortran/testpar/hyper.f90
index a03095a..a2e2e07 100644
--- a/fortran/testpar/hyper.f90
+++ b/fortran/testpar/hyper.f90
@@ -21,8 +21,8 @@
SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors)
USE HDF5
USE TH5_MISC
- USE mpi
IMPLICIT NONE
+ INCLUDE 'mpif.h'
INTEGER, INTENT(in) :: length ! array length
LOGICAL, INTENT(in) :: do_collective ! use collective I/O
diff --git a/fortran/testpar/mdset.f90 b/fortran/testpar/mdset.f90
index f24c862..7fe431b 100644
--- a/fortran/testpar/mdset.f90
+++ b/fortran/testpar/mdset.f90
@@ -21,8 +21,8 @@
SUBROUTINE multiple_dset_write(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors)
USE HDF5
USE TH5_MISC
- USE mpi
IMPLICIT NONE
+ INCLUDE 'mpif.h'
INTEGER, INTENT(in) :: length ! array length
LOGICAL, INTENT(in) :: do_collective ! use collective I/O
diff --git a/fortran/testpar/ptest.f90 b/fortran/testpar/ptest.f90
index 145d084..69594b0 100644
--- a/fortran/testpar/ptest.f90
+++ b/fortran/testpar/ptest.f90
@@ -19,8 +19,9 @@
PROGRAM parallel_test
USE hdf5
- USE mpi
+
IMPLICIT NONE
+ INCLUDE 'mpif.h'
INTEGER :: mpierror ! MPI hdferror flag
INTEGER :: hdferror ! HDF hdferror flag