CMakeLists.txt 4.09 KB
Newer Older
1
cmake_minimum_required (VERSION 2.8.10)
2
set (DKS_VERSION \"1.0.0\")
gsell's avatar
gsell committed
3 4

configure_file(config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
5
configure_file(revision.h.in ${CMAKE_CURRENT_SOURCE_DIR}/revision.h)
gsell's avatar
gsell committed
6 7

set (CMAKE_CXX_FLAGS
8
    "${IPPL_CMAKE_CXX_FLAGS} -DUSEH5FEDV2 -DPARALLEL_IO ${CMAKE_CXX_FLAGS}"
gsell's avatar
gsell committed
9 10
    )

frey_m's avatar
frey_m committed
11 12 13
# remove digits from hostname: edison03 -> edison
STRING(REGEX MATCH "[^0-9]*" HOSTNAME_BASE "${HOSTNAME}")

14
IF(ENABLE_SAAMG_SOLVER)
gsell's avatar
gsell committed
15
    set (CMAKE_CXX_FLAGS
16
        "-DHAVE_SAAMG_SOLVER ${CMAKE_CXX_FLAGS}"
gsell's avatar
gsell committed
17
    )
18
ENDIF(ENABLE_SAAMG_SOLVER)
gsell's avatar
gsell committed
19

20 21 22 23
IF(ENABLE_AMR_SOLVER)
    set (CMAKE_CXX_FLAGS
        "-DHAVE_AMR_SOLVER ${CMAKE_CXX_FLAGS}"
    )
frey_m's avatar
frey_m committed
24 25
    # FIXME Find a better solution!
    # We get otherwise a "undefined reference" to "getLevelBld()" and "probinit_"
frey_m's avatar
frey_m committed
26 27
    set (CBOXLIB -lcboxlib)
    
28
    IF(NOT ${HOSTNAME_BASE} MATCHES "edison" AND NOT ${HOSTNAME_BASE} MATCHES "cori")
frey_m's avatar
frey_m committed
29
        set (CBOXLIB "-lmpi -lmpi_mpifh ${CBOXLIB}")
30
    ENDIF(NOT ${HOSTNAME_BASE} MATCHES "edison" AND NOT ${HOSTNAME_BASE} MATCHES "cori")
frey_m's avatar
frey_m committed
31
    
32 33
ENDIF(ENABLE_AMR_SOLVER)

gsell's avatar
gsell committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
set (OPAL_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
macro (add_sources)
    file (RELATIVE_PATH _relPath "${OPAL_SRC_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    foreach (_src ${ARGN})
        if (_relPath)
            list (APPEND OPAL_SRCS "${_relPath}/${_src}")
        else()
            list (APPEND OPAL_SRCS "${_src}")
        endif()
    endforeach()
    if (_relPath)
        # propagate SRCS to parent directory
        set (OPAL_SRCS ${OPAL_SRCS} PARENT_SCOPE)
    endif()
endmacro()

add_subdirectory (AbstractObjects)
add_subdirectory (Algebra)
add_subdirectory (Algorithms)
add_subdirectory (Aperture)
add_subdirectory (Attributes)
add_subdirectory (BasicActions)
56
add_subdirectory (Classic)
gsell's avatar
gsell committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
add_subdirectory (Distribution)
add_subdirectory (Editor)
add_subdirectory (Elements)
add_subdirectory (Errors)
add_subdirectory (Expressions)
add_subdirectory (Lines)
add_subdirectory (OpalConfigure)
add_subdirectory (OpalParser)
add_subdirectory (Match)
add_subdirectory (PhysicsActions)
add_subdirectory (Solvers)
add_subdirectory (Structure)
add_subdirectory (Tables)
add_subdirectory (Track)
add_subdirectory (Utilities)
add_subdirectory (ValueDefinitions)

74 75
add_sources (opal.cpp)

76
include_directories ( BEFORE
77 78
    ${OPAL_SRC_DIR}
    ${CLASSIC_SRC_DIR}
gsell's avatar
gsell committed
79 80 81 82 83 84
    ${IPPL_INCLUDE_DIR}
    ${H5Hut_INCLUDE_DIR}
    ${HDF5_INCLUDE_DIR}
    ${GSL_INCLUDE_DIR}
    ${Trilinos_INCLUDE_DIRS}
    ${Trilinos_TPL_INCLUDE_DIRS}
85
    ${CCSE_INCLUDE_DIRS}
kraus's avatar
kraus committed
86
    ${GTEST_INCLUDE_DIR}
gsell's avatar
gsell committed
87 88 89 90 91 92
)

link_directories (
    ${IPPL_LIBRARY_DIR}
    ${Trilinos_LIBRARY_DIRS}
    ${Trilinos_TPL_LIBRARY_DIRS}
93
    ${CCSE_LIBRARY_DIR}
gsell's avatar
gsell committed
94 95
)

96
IF (ENABLE_DKS)
97 98
   include_directories (${DKS_INCLUDE_DIR})
   link_directories (${DKS_LIBRARY_DIR})
99
ENDIF (ENABLE_DKS)
100

adelmann's avatar
adelmann committed
101
IF(${HOSTNAME_BASE} MATCHES "edison" OR ${HOSTNAME_BASE} MATCHES "cori")
102 103 104 105 106 107 108 109
 SET (OPAL_LIBS
    ${GSL_LIBRARY}
    ${H5Hut_LIBRARY}
    ${HDF5_LIBRARY}
    ${IPPL_LIBRARY}
    ${Boost_LIBRARIES}
    m
    z
adelmann's avatar
adelmann committed
110
)
111 112
ELSE()
 SET (OPAL_LIBS
gsell's avatar
gsell committed
113 114 115 116
    ${GSL_LIBRARY}
    ${H5Hut_LIBRARY}
    ${HDF5_LIBRARY}
    ${IPPL_LIBRARY}
117
    ${Boost_LIBRARIES}
118 119
    mpi
    mpi_cxx
120 121
    m
    z
gsell's avatar
gsell committed
122
)
adelmann's avatar
adelmann committed
123
ENDIF(${HOSTNAME_BASE} MATCHES "edison" OR ${HOSTNAME_BASE} MATCHES "cori")
124 125


gsell's avatar
gsell committed
126

127
IF (ENABLE_DKS)
128
   set (OPAL_LIBS
129
       ${OPAL_LIBS}
130 131
       ${DKS_LIBRARY_DIR}/libdks.a
       )
132
ENDIF (ENABLE_DKS)
133

134
add_library( OPALib ${OPAL_SRCS})
kraus's avatar
kraus committed
135
set_target_properties( OPALib PROPERTIES OUTPUT_NAME OPAL )
136 137
target_link_libraries( OPALib ${OPAL_LIBS} ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES} ${CCSE_LIBRARIES} ${CBOXLIB} ${OTHER_CMAKE_EXE_LINKER_FLAGS} )

frey_m's avatar
frey_m committed
138
add_executable( opal Main.cpp)
139
target_link_libraries( opal OPALib ${OTHER_CMAKE_EXE_LINKER_FLAGS} ${CMAKE_DL_LIBS})
140 141 142

install (TARGETS ${TEST_EXE} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
install (TARGETS opal RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
gsell's avatar
gsell committed
143 144
install (TARGETS OPALib DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install (FILES opal.h DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
145 146 147
install (FILES Utilities/OpalException.h DESTINATION "${CMAKE_INSTALL_PREFIX}/include/Utilities")

set (OPAL_LIBS ${OPAL_LIBS} PARENT_SCOPE)
148
set (OPAL_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE)