ThirdPartyMPI.cmake 2.03 KB
Newer Older
1 2 3 4 5
OPTION(NEKTAR_USE_MPI "Use MPICH2 for parallelisation." OFF)

CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_GSMPI
    "Build GSMPI if needed" ON
    "NEKTAR_USE_MPI" OFF)
6 7

IF( NEKTAR_USE_MPI )
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
    # First check to see if our compiler has MPI built in to avoid linking libraries etc.
    INCLUDE (CheckIncludeFiles)
    INCLUDE (CheckFunctionExists)
    CHECK_INCLUDE_FILES  (mpi.h    HAVE_MPI_H)
    CHECK_FUNCTION_EXISTS(MPI_Send HAVE_MPI_SEND)

    IF (NOT "${HAVE_MPI_H}" OR NOT "${HAVE_MPI_SEND}")
        INCLUDE (FindMPI)
        MARK_AS_ADVANCED(MPI_LIBRARY)
        MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY)
        MARK_AS_ADVANCED(file_cmd)
        INCLUDE_DIRECTORIES( ${MPI_INCLUDE_PATH} )
        SET(MPI_BUILTIN OFF BOOL INTERNAL)
        MESSAGE(STATUS "Found MPI: ${MPI_LIBRARY}")
    ELSE()
        SET(MPI_BUILTIN ON BOOL INTERNAL)
        MESSAGE(STATUS "Found MPI: built in")
    ENDIF()

27
    ADD_DEFINITIONS(-DNEKTAR_USE_MPI)
28

29 30
    IF (THIRDPARTY_BUILD_GSMPI)
        EXTERNALPROJECT_ADD(
31
            gsmpi-1.1.1
32
            PREFIX ${TPSRC}
33 34
            URL http://xyloid.org/gsmpi-1.1.1.tar.bz2
            URL_MD5 48a6006437e094f6cccce65dcf79f967
35 36
            DOWNLOAD_DIR ${TPSRC}
            CONFIGURE_COMMAND 
37
                ${CMAKE_COMMAND}
38 39 40 41
                -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
                -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
                -DCMAKE_BUILD_TYPE:STRING=Debug
                -DCMAKE_INSTALL_PREFIX:PATH=${TPSRC}/dist
42
                ${TPSRC}/src/gsmpi-1.1.1
43
        )
44
        SET(GSMPI_LIBRARY gsmpi CACHE FILEPATH
45
            "GSMPI path" FORCE)
46
        MARK_AS_ADVANCED(GSMPI_LIBRARY)
Chris Cantwell's avatar
Chris Cantwell committed
47 48
        SET(XXT_LIBRARY xxt CACHE FILEPATH
            "XXT path" FORCE)
49
        MARK_AS_ADVANCED(XXT_LIBRARY)
50 51
        MESSAGE(STATUS "Build GSMPI: ${TPSRC}/dist/lib/lib${GSMPI_LIBRARY}.a")
        MESSAGE(STATUS "Build XXT: ${TPSRC}/dist/lib/lib${XXT_LIBRARY}.a")
52 53
    ELSE (THIRDPARTY_BUILD_GSMPI)
        INCLUDE (FindGSMPI)
Chris Cantwell's avatar
Chris Cantwell committed
54
        INCLUDE (FindXXT)
55 56 57
    ENDIF (THIRDPARTY_BUILD_GSMPI)
ENDIF( NEKTAR_USE_MPI )