diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-11-03 21:06:37 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-11-03 21:06:37 (GMT) |
commit | 49fabfad86090e104a2bf9273f9b93ecd8dd8e22 (patch) | |
tree | 6f033eb795b4812019e9bd0aff39c9fcf05e6140 /fortran | |
parent | 677380aa5a1ca7780855935422ee7a5f62682b53 (diff) | |
download | hdf5-49fabfad86090e104a2bf9273f9b93ecd8dd8e22.zip hdf5-49fabfad86090e104a2bf9273f9b93ecd8dd8e22.tar.gz hdf5-49fabfad86090e104a2bf9273f9b93ecd8dd8e22.tar.bz2 |
[svn-r21710] CMake FindMPI module changed to look for fortran libs. Cmake files updated to link with fortran mpi libs.
Updated cacheinit.cmake to set num of procs to 3 for hdf testing.
Tested: local linux and on windows 7
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/CMakeLists.txt | 8 | ||||
-rw-r--r-- | fortran/examples/CMakeLists.txt | 8 | ||||
-rw-r--r-- | fortran/src/CMakeLists.txt | 11 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 10 | ||||
-rw-r--r-- | fortran/testpar/CMakeLists.txt | 1 |
5 files changed, 20 insertions, 18 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 609d965..3f3ae9f 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -92,8 +92,7 @@ FOREACH (example ${F2003_examples}) 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 "") @@ -106,12 +105,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 bc6ab33..ec4d7d1 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -115,7 +115,7 @@ 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) @@ -180,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 @@ -220,6 +220,9 @@ 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) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 7342850..ed7c147 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -21,18 +21,12 @@ 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) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index b8647b6..ef2aa4e 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -22,6 +22,7 @@ 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") |