summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-11-04 18:45:41 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-11-04 18:45:41 (GMT)
commit141383fb261f02c5fab510ffa9b2ff8be11f1cec (patch)
treeafe2beaebfb2aea6750925c64f051a8fa98169de /fortran
parent9417e52b8be3453b60f7717ab33d42d7d91784a2 (diff)
downloadhdf5-141383fb261f02c5fab510ffa9b2ff8be11f1cec.zip
hdf5-141383fb261f02c5fab510ffa9b2ff8be11f1cec.tar.gz
hdf5-141383fb261f02c5fab510ffa9b2ff8be11f1cec.tar.bz2
[svn-r21717] Update cmake configuration
Update cmake to generate source folders in VS Brought parallel changes from trunk Tested: local linux
Diffstat (limited to 'fortran')
-rw-r--r--fortran/CMakeLists.txt8
-rw-r--r--fortran/examples/CMakeLists.txt10
-rw-r--r--fortran/src/CMakeLists.txt13
-rw-r--r--fortran/test/CMakeLists.txt17
-rw-r--r--fortran/testpar/CMakeLists.txt2
5 files changed, 33 insertions, 17 deletions
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
index 1a6329f..4796187 100644
--- a/fortran/CMakeLists.txt
+++ b/fortran/CMakeLists.txt
@@ -1,6 +1,10 @@
cmake_minimum_required (VERSION 2.8)
PROJECT (HDF5_F90 C CXX Fortran)
+IF (H5_HAVE_PARALLEL)
+ FIND_PACKAGE (MPI)
+ENDIF (H5_HAVE_PARALLEL)
+
#-----------------------------------------------------------------------------
# Traverse source subdirectory
#-----------------------------------------------------------------------------
@@ -18,7 +22,7 @@ ENDIF (HDF5_BUILD_EXAMPLES)
#-----------------------------------------------------------------------------
IF (BUILD_TESTING)
ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/test ${HDF5_F90_BINARY_DIR}/test)
- IF (H5_HAVE_PARALLEL)
+ IF (MPI_Fortran_FOUND)
ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/testpar ${HDF5_F90_BINARY_DIR}/testpar)
- ENDIF (H5_HAVE_PARALLEL)
+ ENDIF (MPI_Fortran_FOUND)
ENDIF (BUILD_TESTING)
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index 47c221c..8f858a3 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -52,6 +52,7 @@ FOREACH (example ${examples})
${HDF5_LIB_TARGET}
)
SET_TARGET_PROPERTIES (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+ SET_TARGET_PROPERTIES (f90_ex_${example} PROPERTIES FOLDER examples/fortran)
IF (BUILD_TESTING)
ADD_TEST (NAME f90_ex_${example} COMMAND $<TARGET_FILE:f90_ex_${example}>)
@@ -78,6 +79,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003)
${HDF5_LIB_TARGET}
)
SET_TARGET_PROPERTIES (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+ SET_TARGET_PROPERTIES (f03_ex_${example} PROPERTIES FOLDER examples/fortran03)
IF (BUILD_TESTING)
ADD_TEST (NAME f03_ex_${example} COMMAND $<TARGET_FILE:f03_ex_${example}>)
@@ -89,7 +91,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003)
ENDFOREACH (example ${F2003_examples})
ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003)
-IF (H5_HAVE_PARALLEL)
+IF (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
ADD_EXECUTABLE (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
TARGET_NAMING (f90_ex_ph5example ${LIB_TYPE})
TARGET_FORTRAN_WIN_PROPERTIES (f90_ex_ph5example "")
@@ -102,11 +104,13 @@ IF (H5_HAVE_PARALLEL)
TARGET_LINK_LIBRARIES (f90_ex_ph5example
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
+ ${MPI_Fortran_LIBRARIES}
)
SET_TARGET_PROPERTIES (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran)
+ SET_TARGET_PROPERTIES (f90_ex_ph5example PROPERTIES FOLDER examples/fortran)
IF (BUILD_TESTING)
- ADD_TEST (NAME f90_ex_ph5example COMMAND $<TARGET_FILE:f90_ex_ph5example>)
+ ADD_TEST (NAME f90_ex_ph5example COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:f90_ex_ph5example>)
ENDIF (BUILD_TESTING)
-ENDIF (H5_HAVE_PARALLEL)
+ENDIF (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index bb927eb..ec4d7d1 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -115,9 +115,10 @@ ENDIF (H5_HAVE_PARALLEL)
SET_SOURCE_FILES_PROPERTIES (${f90CStub_C_SRCS} PROPERTIES LANGUAGE C)
ADD_LIBRARY (${HDF5_F90_C_LIB_TARGET} ${LIB_TYPE} ${f90CStub_C_SRCS})
-TARGET_LINK_LIBRARIES (${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET})
+TARGET_LINK_LIBRARIES (${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_LIBS})
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} ${LIB_TYPE})
+SET_TARGET_PROPERTIES (${HDF5_F90_C_LIB_TARGET} PROPERTIES FOLDER libraries/fortran)
#-----------------------------------------------------------------------------
# Fortran 2003 standard
@@ -179,18 +180,18 @@ SET (f90_F_SRCS
#-----------------------------------------------------------------------------
# Add H5FDMPIO if parallel
#-----------------------------------------------------------------------------
-IF (H5_HAVE_PARALLEL)
+IF (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
SET (f90_F_SRCS
${f90_F_SRCS}
${HDF5_F90_SRC_SOURCE_DIR}/HDF5mpio.f90
${HDF5_F90_SRC_SOURCE_DIR}/H5FDmpioff.f90
)
-ELSE (H5_HAVE_PARALLEL)
+ELSE (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
SET (f90_F_SRCS
${f90_F_SRCS}
${HDF5_F90_SRC_SOURCE_DIR}/HDF5.f90
)
-ENDIF (H5_HAVE_PARALLEL)
+ENDIF (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
#-----------------------------------------------------------------------------
# Add Main fortran library
@@ -219,8 +220,12 @@ ENDIF (WIN32 AND NOT CYGWIN)
TARGET_FORTRAN_WIN_PROPERTIES (${HDF5_F90_LIB_TARGET} ${SHARED_LINK_FLAGS})
SET_TARGET_PROPERTIES (${HDF5_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
TARGET_LINK_LIBRARIES (${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET})
+IF (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
+ TARGET_LINK_LIBRARIES (${HDF5_F90_LIB_TARGET} ${MPI_Fortran_LIBRARIES})
+ENDIF (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} ${LIB_TYPE})
+SET_TARGET_PROPERTIES (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran)
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index e4cc94d..ed7c147 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -15,23 +15,18 @@ TARGET_LINK_LIBRARIES (${HDF5_F90_C_TEST_LIB_TARGET}
${HDF5_TEST_LIB_TARGET}
)
H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} ${LIB_TYPE})
+SET_TARGET_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran)
ADD_LIBRARY (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.f90)
SET (SHARED_LINK_FLAGS " ")
IF (WIN32 AND NOT CYGWIN)
IF (BUILD_SHARED_LIBS)
- SET_PROPERTY (TARGET ${HDF5_F90_TEST_LIB_TARGET}
- APPEND PROPERTY COMPILE_DEFINITIONS
- BUILD_HDF5_DLL
- )
+ SET_PROPERTY (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS BUILD_HDF5_DLL)
IF (MSVC)
SET (SHARED_LINK_FLAGS "/DLL")
ENDIF (MSVC)
ENDIF (BUILD_SHARED_LIBS)
- SET_PROPERTY (TARGET ${HDF5_F90_TEST_LIB_TARGET}
- APPEND PROPERTY COMPILE_DEFINITIONS
- HDF5F90_WINDOWS
- )
+ SET_PROPERTY (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS HDF5F90_WINDOWS)
ENDIF (WIN32 AND NOT CYGWIN)
TARGET_FORTRAN_WIN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} ${SHARED_LINK_FLAGS})
SET_TARGET_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
@@ -41,6 +36,7 @@ TARGET_LINK_LIBRARIES (${HDF5_F90_TEST_LIB_TARGET}
${HDF5_LIB_TARGET}
)
H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} ${LIB_TYPE})
+SET_TARGET_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran)
#-----------------------------------------------------------------------------
# Add Tests
@@ -74,6 +70,7 @@ IF (WIN32 AND MSVC)
TARGET_LINK_LIBRARIES (testhdf5_fortran "ws2_32.lib")
ENDIF (WIN32 AND MSVC)
SET_TARGET_PROPERTIES (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran)
+SET_TARGET_PROPERTIES (testhdf5_fortran PROPERTIES FOLDER test/fortran)
ADD_TEST (NAME testhdf5_fortran COMMAND $<TARGET_FILE:testhdf5_fortran>)
@@ -96,6 +93,7 @@ IF (WIN32 AND MSVC)
TARGET_LINK_LIBRARIES (testhdf5_fortran_1_8 "ws2_32.lib")
ENDIF (WIN32 AND MSVC)
SET_TARGET_PROPERTIES (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran)
+SET_TARGET_PROPERTIES (testhdf5_fortran_1_8 PROPERTIES FOLDER test/fortran)
ADD_TEST (NAME testhdf5_fortran_1_8 COMMAND $<TARGET_FILE:testhdf5_fortran_1_8>)
@@ -120,6 +118,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003)
TARGET_LINK_LIBRARIES (fortranlib_test_F03 "ws2_32.lib")
ENDIF (WIN32 AND MSVC)
SET_TARGET_PROPERTIES (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran)
+ SET_TARGET_PROPERTIES (fortranlib_test_F03 PROPERTIES FOLDER test/fortran)
ADD_TEST (NAME fortranlib_test_F03 COMMAND $<TARGET_FILE:fortranlib_test_F03>)
ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003)
@@ -137,6 +136,7 @@ IF (WIN32 AND MSVC)
TARGET_LINK_LIBRARIES (fflush1 "ws2_32.lib")
ENDIF (WIN32 AND MSVC)
SET_TARGET_PROPERTIES (fflush1 PROPERTIES LINKER_LANGUAGE Fortran)
+SET_TARGET_PROPERTIES (fflush1 PROPERTIES FOLDER test/fortran)
ADD_TEST (NAME fflush1 COMMAND $<TARGET_FILE:fflush1>)
@@ -153,6 +153,7 @@ IF (WIN32 AND MSVC)
TARGET_LINK_LIBRARIES (fflush2 "ws2_32.lib")
ENDIF (WIN32 AND MSVC)
SET_TARGET_PROPERTIES (fflush2 PROPERTIES LINKER_LANGUAGE Fortran)
+SET_TARGET_PROPERTIES (fflush2 PROPERTIES FOLDER test/fortran)
ADD_TEST (NAME fflush2 COMMAND $<TARGET_FILE:fflush2>)
SET_TESTS_PROPERTIES(fflush2 PROPERTIES DEPENDS fflush1)
diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt
index c71f679..ef2aa4e 100644
--- a/fortran/testpar/CMakeLists.txt
+++ b/fortran/testpar/CMakeLists.txt
@@ -22,10 +22,12 @@ TARGET_LINK_LIBRARIES (parallel_test
${HDF5_F90_TEST_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
+ ${MPI_Fortran_LIBRARIES}
)
IF (WIN32 AND MSVC)
TARGET_LINK_LIBRARIES (parallel_test "ws2_32.lib")
ENDIF (WIN32 AND MSVC)
SET_TARGET_PROPERTIES (parallel_test PROPERTIES LINKER_LANGUAGE Fortran)
+SET_TARGET_PROPERTIES (parallel_test PROPERTIES FOLDER test/fortran)
ADD_TEST (NAME parallel_test COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:parallel_test>)