summaryrefslogtreecommitdiffstats
path: root/fortran/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2015-09-10 14:11:17 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2015-09-10 14:11:17 (GMT)
commit10da31a926a0a2b4e2cee11656a89d5ab966815e (patch)
treea1544263bd33d1bd3e904a7352766fc3eb60d303 /fortran/test
parent1dc01a33b277bd48e6ac2d829d0f4f870cee83aa (diff)
downloadhdf5-10da31a926a0a2b4e2cee11656a89d5ab966815e.zip
hdf5-10da31a926a0a2b4e2cee11656a89d5ab966815e.tar.gz
hdf5-10da31a926a0a2b4e2cee11656a89d5ab966815e.tar.bz2
[svn-r27745] Merge trunk revision 27744
Diffstat (limited to 'fortran/test')
-rw-r--r--fortran/test/CMakeLists.txt110
-rw-r--r--fortran/test/Makefile.am5
-rw-r--r--fortran/test/fortranlib_test.F902
3 files changed, 74 insertions, 43 deletions
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