ThirdPartyOCE.cmake 2.62 KB
Newer Older
1 2 3 4 5 6 7
########################################################################
#
# ThirdParty configuration for Nektar++
#
# OpenCascade
#
########################################################################
8

9
IF(NEKTAR_USE_MESHGEN)
10
    # Try to find installed version of OpenCascade
11
    INCLUDE(FindOCC)
12

13
    IF (OCC_FOUND)
Michael Turner's avatar
Michael Turner committed
14
        SET(BUILD_OCE OFF)
15
    ELSE()
Michael Turner's avatar
Michael Turner committed
16
        SET(BUILD_OCE ON)
17
    ENDIF()
18

Michael Turner's avatar
Michael Turner committed
19 20
    OPTION(THIRDPARTY_BUILD_OCE "Build OpenCascade community edition library from ThirdParty."
        ${BUILD_OCE})
21

Michael Turner's avatar
Michael Turner committed
22
    IF (THIRDPARTY_BUILD_OCE)
Dave Moxey's avatar
Dave Moxey committed
23 24
        INCLUDE(ExternalProject)

25
        SET(OCC_LIBRARIES_TMP PTKernel TKernel TKMath TKBRep TKIGES TKSTEP TKSTEPAttr
Dave Moxey's avatar
Dave Moxey committed
26
            TKSTEP209 TKSTEPBase TKShapeSchema TKGeomBase TKGeomAlgo TKG3d TKG2d
27
            TKXSBase TKPShape TKTopAlgo TKShHealing)
28 29
        FOREACH(OCC_LIB ${OCC_LIBRARIES_TMP})
            LIST(APPEND OCC_LIBRARIES ${TPDIST}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${OCC_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX})
Dave Moxey's avatar
Dave Moxey committed
30
        ENDFOREACH()
31
        UNSET(OCC_LIBRARIES_TMP)
Dave Moxey's avatar
Dave Moxey committed
32

33
        IF(WIN32)
Dave Moxey's avatar
Dave Moxey committed
34
            MESSAGE(SEND_ERROR "Cannot currently use OpenCascade with Nektar++ on Windows")
35
        ENDIF()
36

37
        EXTERNALPROJECT_ADD(
Michael Turner's avatar
Michael Turner committed
38
            oce-0.17
39
            PREFIX ${TPSRC}
Dave Moxey's avatar
Dave Moxey committed
40
            URL ${TPURL}/OCE-0.17.2.tar.gz
41
            URL_MD5 bf2226be4cd192606af677cf178088e5
42
            STAMP_DIR ${TPBUILD}/stamp
Michael Turner's avatar
Michael Turner committed
43
            BINARY_DIR ${TPBUILD}/oce-0.17
44
            DOWNLOAD_DIR ${TPSRC}
Michael Turner's avatar
Michael Turner committed
45 46
            SOURCE_DIR ${TPSRC}/oce-0.17
            INSTALL_DIR ${TPBUILD}/oce-0.17/dist
47 48 49 50
            CONFIGURE_COMMAND ${CMAKE_COMMAND}
                -G ${CMAKE_GENERATOR}
                -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
                -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
51 52 53 54
                -DOCE_INSTALL_PREFIX:PATH=${TPDIST}
                -DOCE_TESTING=OFF
                -DOCE_VISUALISATION=OFF
                -DOCE_DISABLE_X11=ON
Michael Turner's avatar
Michael Turner committed
55 56
                -DOCE_OCAF=OFF
                ${TPSRC}/oce-0.17
57
            )
Michael Turner's avatar
Michael Turner committed
58

59
        # Patch OS X libraries to fix install name problems.
60 61 62 63 64
        IF(APPLE)
            EXTERNALPROJECT_ADD_STEP(oce-0.17 patch-install-path
                COMMAND bash ${CMAKE_SOURCE_DIR}/cmake/scripts/patch-occ.sh ${TPDIST}/lib ${CMAKE_INSTALL_PREFIX}/${NEKTAR_LIB_DIR}
                DEPENDEES install)
        ENDIF()
Dave Moxey's avatar
Dave Moxey committed
65

Michael Turner's avatar
Michael Turner committed
66
        MESSAGE(STATUS "Build OpenCascade community edition: ${TPDIST}/lib")
Dave Moxey's avatar
Dave Moxey committed
67
        LINK_DIRECTORIES(${TPDIST}/lib)
68
        INCLUDE_DIRECTORIES(SYSTEM ${TPDIST}/include/oce)
69
    ELSE()
Michael Turner's avatar
Michael Turner committed
70
        ADD_CUSTOM_TARGET(oce-0.17 ALL)
71 72
        SET(OPENCASCADE_CONFIG_INCLUDE_DIR ${OCC_INCLUDE_DIR})
        INCLUDE_DIRECTORIES(SYSTEM ${OCC_INCLUDE_DIR})
73 74
    ENDIF()
ENDIF()