CMakeLists.txt 2.15 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

## usage: cmake -DCMAKE_INSTALL_PREFIX=<install/path> .
## use -DBUILD_APPCSXCAD=NO to not build QCSXCAD and AppCSXCAD

PROJECT(openEMS-Project CXX)

cmake_minimum_required(VERSION 2.8)

if (CMAKE_TOOLCHAIN_FILE)
    message(STATUS "Using CMAKE_TOOLCHAIN_FILE: " ${CMAKE_TOOLCHAIN_FILE})
endif()

if (CMAKE_INSTALL_PREFIX)
    message(STATUS "Using CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX})
endif()

if (NOT DEFINED BUILD_APPCSXCAD)
    set(BUILD_APPCSXCAD "YES")
endif()

message(STATUS "Build AppCSXCAD: " ${BUILD_APPCSXCAD})

IF(EXISTS ${PROJECT_SOURCE_DIR}/localConfig.cmake)
   message(STATUS "include local config" )
   include(${PROJECT_SOURCE_DIR}/localConfig.cmake)
ENDIF()

include(ExternalProject)

# build fparser
ExternalProject_Add( fparser
  SOURCE_DIR  ${PROJECT_SOURCE_DIR}/fparser
  CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)

# build CSXCAD
ExternalProject_Add( CSXCAD 
  DEPENDS     fparser
  SOURCE_DIR  ${PROJECT_SOURCE_DIR}/CSXCAD
  CMAKE_ARGS  -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DFPARSER_ROOT_DIR=${CMAKE_INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)

message(STATUS "with MPI: ${WITH_MPI}" )
# build openEMS
ExternalProject_Add( openEMS
  DEPENDS     fparser CSXCAD
  SOURCE_DIR  ${PROJECT_SOURCE_DIR}/openEMS
  CMAKE_ARGS  -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DFPARSER_ROOT_DIR=${CMAKE_INSTALL_PREFIX} -DCSXCAD_ROOT_DIR=${CMAKE_INSTALL_PREFIX} -DWITH_MPI=${WITH_MPI} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)

if (${BUILD_APPCSXCAD})
    # build QCSXCAD
    ExternalProject_Add( QCSXCAD
    DEPENDS     CSXCAD
    SOURCE_DIR  ${PROJECT_SOURCE_DIR}/QCSXCAD
    CMAKE_ARGS  -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCSXCAD_ROOT_DIR=${CMAKE_INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
    )

    # build AppCSXCAD
    ExternalProject_Add( AppCSXCAD
    DEPENDS     QCSXCAD
    SOURCE_DIR  ${PROJECT_SOURCE_DIR}/AppCSXCAD
    CMAKE_ARGS  -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCSXCAD_ROOT_DIR=${CMAKE_INSTALL_PREFIX} -DQCSXCAD_ROOT_DIR=${CMAKE_INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
    )
endif()