ThirdPartyCCM.cmake 2.62 KB
Newer Older
1 2 3 4
########################################################################
#
# ThirdParty configuration for Nektar++
#
Michael Turner's avatar
Michael Turner committed
5
# Star CCM i/o
6 7
#
########################################################################
Michael Turner's avatar
Michael Turner committed
8
OPTION(NEKTAR_USE_CCM
9
   "use CCM star i/o" OFF)
10

's avatar
fix  
committed
11 12
IF(NEKTAR_USE_CCM)

13
# First search for system ccmioL installs. Hint /usr/local 
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
FIND_PATH   (CCMIO_INCLUDE_DIR ccmio.h PATHS /usr/local/include)
FIND_LIBRARY(CCMIO_LIBRARY NAMES "ccmio" PATHS /usr/local/lib)

# If we have our library then don't build CCMIO.
IF (CCMIO_INCLUDE_DIR AND CCMIO_LIBRARY)
    SET(BUILD_CCMIO OFF)
ELSE()
    SET(BUILD_CCMIO ON)
ENDIF ()

OPTION(THIRDPARTY_BUILD_CCMIO 
    "Build CCMIO library from ThirdParty if permitted." ${BUILD_CCMIO})

IF (THIRDPARTY_BUILD_CCMIO)
    INCLUDE(ExternalProject)
29
    MESSAGE(WARNING "We are seeking permission to distribute ccmio with Nektar++. If you are entitled to use libccmio please contact nektar-users@imperial.ac.uk and place the file ccmio-2.06.tar.bz2 in the director $NEKTAR/ThirdParty")
30 31 32
    EXTERNALPROJECT_ADD(
        ccmio-2.06
        PREFIX ${TPSRC}
33
        URL ${TPURL}/ccmio-2.06.tar.bz2
34
        URL_MD5 809ee34a983cbc8931ca23879d92b4d0
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
        STAMP_DIR ${TPBUILD}/stamp
        DOWNLOAD_DIR ${TPSRC}
        SOURCE_DIR ${TPSRC}/ccmio-2.06
        BINARY_DIR ${TPBUILD}/ccmio-2.06
        TMP_DIR ${TPBUILD}/ccmio-2.06-tmp
        INSTALL_DIR ${TPDIST}
        CONFIGURE_COMMAND ${CMAKE_COMMAND}
            -G ${CMAKE_GENERATOR}
            -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
            -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
            -DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
            ${TPSRC}/ccmio-2.06
    )
    SET(CCMIO_LIBRARY ccmio CACHE FILEPATH
        "CCMIO library" FORCE)
    SET(CCMIO_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
        "CCMIO include" FORCE)

    LINK_DIRECTORIES(${TPDIST}/lib)

    INCLUDE_DIRECTORIES(NekMesh ${CCMIO_INCLUDE_DIR})

    IF (WIN32)
        MESSAGE(STATUS 
59
                "Build CCMIO: ${TPDIST}/${LIB_DIR}/${CCMIO_LIBRARY}.dll")
60 61
    ELSE ()
        MESSAGE(STATUS 
62
                "Build CCMIO: ${TPDIST}/${LIB_DIR}/lib${CCMIO_LIBRARY}.a")
63 64 65
    ENDIF ()

    SET(CCMIO_CONFIG_INCLUDE_DIR ${TPINC})
Michael Turner's avatar
Michael Turner committed
66 67 68 69 70

    set(CCMIO_LIBRARIES
        ccmio
        adf
    )
71 72 73 74 75 76 77 78
ELSE()
    ADD_CUSTOM_TARGET(ccmio-2.06 ALL)
    MESSAGE(STATUS "Found CCMIO: ${CCMIO_LIBRARY}")
    SET(CCMIO_CONFIG_INCLUDE_DIR ${CCMIO_INCLUDE_DIR})
    INCLUDE_DIRECTORIES(NekMesh ${CCMIO_INCLUDE_DIR})
    LINK_DIRECTORIES(${CCMIO_LIBRARY_DIR})

ENDIF (THIRDPARTY_BUILD_CCMIO)
Michael Turner's avatar
Michael Turner committed
79

80
SET(CCMIO_LIBRARIES ccmio adf)
81

82 83
MARK_AS_ADVANCED(CCMIO_INCLUDE_DIR)
MARK_AS_ADVANCED(CCMIO_LIBRARY)
's avatar
fix  
committed
84 85

ENDIF(NEKTAR_USE_CCM)