ThirdPartyMetis.cmake 1.72 KB
Newer Older
Dave Moxey's avatar
Dave Moxey committed
1 2 3 4
########################################################################
#
# ThirdParty configuration for Nektar++
#
5
# Modified METIS library
Dave Moxey's avatar
Dave Moxey committed
6 7
#
########################################################################
8

Dave Moxey's avatar
Dave Moxey committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22
INCLUDE(ExternalProject)

EXTERNALPROJECT_ADD(
    modmetis-5.1.0
    PREFIX ${TPSRC}
    URL ${TPURL}/modmetis-5.1.0_2.tar.bz2
    URL_MD5 "8a1f1afd39b46a4477c1ea15464cdf89"
    STAMP_DIR ${TPBUILD}/stamp
    DOWNLOAD_DIR ${TPSRC}
    SOURCE_DIR ${TPSRC}/modmetis-5.1.0
    BINARY_DIR ${TPBUILD}/modmetis-5.1.0
    TMP_DIR ${TPBUILD}/modmetis-5.1.0-tmp
    INSTALL_DIR ${TPDIST}
    CONFIGURE_COMMAND ${CMAKE_COMMAND}
23
        -G ${CMAKE_GENERATOR}
Dave Moxey's avatar
Dave Moxey committed
24 25 26
        -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
        -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
        -DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
Chris Cantwell's avatar
Chris Cantwell committed
27
        -DCMAKE_C_FLAGS:STRING=-fPIC\ -w
Dave Moxey's avatar
Dave Moxey committed
28 29
        -DGKLIB_PATH:PATH=${TPSRC}/modmetis-5.1.0/GKlib
        ${TPSRC}/modmetis-5.1.0
30 31 32 33 34 35 36 37 38 39 40 41
    )

IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    # Clang 7.3 has a lovely bug that needs to be patched in order for it to
    # compile.
    IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.3")
        EXTERNALPROJECT_ADD_STEP(modmetis-5.1.0 patch-install-path
            COMMAND sed -i ".bak" "s|#define MAX_JBUFS 128|#define MAX_JBUFS 24|" ${TPSRC}/modmetis-5.1.0/GKlib/error.c
            DEPENDERS build
            DEPENDEES download)
    ENDIF()
ENDIF()
42

43
SET(METIS_LIB metis CACHE FILEPATH "METIS library" FORCE)
Dave Moxey's avatar
Dave Moxey committed
44 45 46 47 48
MARK_AS_ADVANCED(METIS_LIB)

LINK_DIRECTORIES(${TPDIST}/lib)
INCLUDE_DIRECTORIES(${TPDIST}/include)

49 50 51 52 53
IF (WIN32)
    MESSAGE(STATUS "Build Metis: ${TPDIST}/${LIB_DIR}/${METIS_LIB}.dll")
ELSE ()
    MESSAGE(STATUS "Build Metis: ${TPDIST}/${LIB_DIR}/lib${METIS_LIB}.a")
ENDIF()