CMakeLists.txt 4.54 KB
Newer Older
1
cmake_minimum_required (VERSION 2.8.10)
2
set (DKS_VERSION_OPAL \"${DKS_VERSION}\")
gsell's avatar
gsell committed
3 4

set (CMAKE_CXX_FLAGS
5
    "${IPPL_CMAKE_CXX_FLAGS} -DUSEH5FEDV2 -DPARALLEL_IO ${CMAKE_CXX_FLAGS}"
gsell's avatar
gsell committed
6 7
    )

8
IF(ENABLE_SAAMG_SOLVER)
gsell's avatar
gsell committed
9
    set (CMAKE_CXX_FLAGS
10
        "-DHAVE_SAAMG_SOLVER ${CMAKE_CXX_FLAGS}"
gsell's avatar
gsell committed
11
    )
12
ENDIF(ENABLE_SAAMG_SOLVER)
gsell's avatar
gsell committed
13

14 15 16 17
IF(ENABLE_AMR_SOLVER)
    set (CMAKE_CXX_FLAGS
        "-DHAVE_AMR_SOLVER ${CMAKE_CXX_FLAGS}"
    )
frey_m's avatar
frey_m committed
18 19
    # FIXME Find a better solution!
    # We get otherwise a "undefined reference" to "getLevelBld()" and "probinit_"
frey_m's avatar
frey_m committed
20
    set (CBOXLIB -lcboxlib)
21

22
    IF(NOT ${HOSTNAME_BASE} MATCHES "edison" AND NOT ${HOSTNAME_BASE} MATCHES "cori")
frey_m's avatar
frey_m committed
23
        set (CBOXLIB "-lmpi -lmpi_mpifh ${CBOXLIB}")
24
    ENDIF(NOT ${HOSTNAME_BASE} MATCHES "edison" AND NOT ${HOSTNAME_BASE} MATCHES "cori")
25

26 27
ENDIF(ENABLE_AMR_SOLVER)

28 29 30 31
SET (PACKAGE_COMPILE_OPTIONS \"${CMAKE_CXX_FLAGS}\")
configure_file(config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/OPALconfig.h)
configure_file(revision.h.in ${CMAKE_CURRENT_SOURCE_DIR}/OPALrevision.h)

32 33 34
SET (OPAL_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET (OPAL_SRCS )
macro (ADD_OPAL_SOURCES)
gsell's avatar
gsell committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48
    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()

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
MACRO (ADD_OPAL_HEADERS )
    FILE (RELATIVE_PATH _relPath "${OPAL_SRC_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
    FOREACH (_hdr ${ARGN})
        IF (_relPath)
            LIST (APPEND OPAL_HDRS "${_relPath}/${_hdr}")
        ELSE ()
            LIST (APPEND OPAL_HDRS "${_hdr}")
        ENDIF ()
    ENDFOREACH ()
    IF (_relPath)
        # propagate HDRS to parent directory
        SET (OPAL_HDRS ${OPAL_HDRS} PARENT_SCOPE)
    ENDIF ()
ENDMACRO ()

gsell's avatar
gsell committed
64 65 66 67 68 69
add_subdirectory (AbstractObjects)
add_subdirectory (Algebra)
add_subdirectory (Algorithms)
add_subdirectory (Aperture)
add_subdirectory (Attributes)
add_subdirectory (BasicActions)
70
add_subdirectory (Classic)
gsell's avatar
gsell committed
71 72 73 74 75 76 77 78 79 80 81
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)
82
add_subdirectory (Steppers)
gsell's avatar
gsell committed
83 84 85 86 87 88
add_subdirectory (Structure)
add_subdirectory (Tables)
add_subdirectory (Track)
add_subdirectory (Utilities)
add_subdirectory (ValueDefinitions)

89 90
ADD_OPAL_SOURCES(opal.cpp)
ADD_OPAL_SOURCES(changes.cpp)
91

92
include_directories ( BEFORE
93 94
    ${OPAL_SRC_DIR}
    ${CLASSIC_SRC_DIR}
gsell's avatar
gsell committed
95 96 97 98 99 100
    ${IPPL_INCLUDE_DIR}
    ${H5Hut_INCLUDE_DIR}
    ${HDF5_INCLUDE_DIR}
    ${GSL_INCLUDE_DIR}
    ${Trilinos_INCLUDE_DIRS}
    ${Trilinos_TPL_INCLUDE_DIRS}
101
    ${IPPL_SOURCE_DIRS}
102
    ${CCSE_INCLUDE_DIRS}
kraus's avatar
kraus committed
103
    ${GTEST_INCLUDE_DIR}
gsell's avatar
gsell committed
104 105 106 107 108 109
)

link_directories (
    ${IPPL_LIBRARY_DIR}
    ${Trilinos_LIBRARY_DIRS}
    ${Trilinos_TPL_LIBRARY_DIRS}
110
    ${CCSE_LIBRARY_DIR}
gsell's avatar
gsell committed
111 112
)

113
IF (ENABLE_DKS)
114 115
   include_directories (${DKS_INCLUDE_DIR})
   link_directories (${DKS_LIBRARY_DIR})
116
ENDIF (ENABLE_DKS)
117

adelmann's avatar
adelmann committed
118
IF(${HOSTNAME_BASE} MATCHES "edison" OR ${HOSTNAME_BASE} MATCHES "cori")
119 120 121 122 123 124 125 126
 SET (OPAL_LIBS
    ${GSL_LIBRARY}
    ${H5Hut_LIBRARY}
    ${HDF5_LIBRARY}
    ${IPPL_LIBRARY}
    ${Boost_LIBRARIES}
    m
    z
adelmann's avatar
adelmann committed
127
)
128 129
ELSE()
 SET (OPAL_LIBS
gsell's avatar
gsell committed
130 131 132 133
    ${GSL_LIBRARY}
    ${H5Hut_LIBRARY}
    ${HDF5_LIBRARY}
    ${IPPL_LIBRARY}
134
    ${Boost_LIBRARIES}
135 136
    mpi
    mpi_cxx
137 138
    m
    z
gsell's avatar
gsell committed
139
)
adelmann's avatar
adelmann committed
140
ENDIF(${HOSTNAME_BASE} MATCHES "edison" OR ${HOSTNAME_BASE} MATCHES "cori")
141

142
IF (ENABLE_DKS)
143
   set (OPAL_LIBS
144
       ${OPAL_LIBS}
145 146
       dks 
       ${DKS_CUDA_LIBS})
147
ENDIF (ENABLE_DKS)
148

149
add_library( OPALib ${OPAL_SRCS} )
kraus's avatar
kraus committed
150
set_target_properties( OPALib PROPERTIES OUTPUT_NAME OPAL )
151
target_link_libraries( OPALib ${OPAL_LIBS} ${Trilinos_LIBRARIES} ${CCSE_LIBRARIES} ${OTHER_CMAKE_EXE_LINKER_FLAGS} )
152

frey_m's avatar
frey_m committed
153
add_executable( opal Main.cpp)
154
target_link_libraries( opal OPALib ${OPAL_LIBS} ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES} -lgfortran ${CCSE_LIBRARIES} ${CBOXLIB} ${OTHER_CMAKE_EXE_LINKER_FLAGS} ${CMAKE_DL_LIBS})
155 156 157

install (TARGETS ${TEST_EXE} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
install (TARGETS opal RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
gsell's avatar
gsell committed
158
install (TARGETS OPALib DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
159

160
set (HDRS
161
    OPALconfig.h
162
    opal.h
163
    OPALrevision.h
164 165 166 167
    changes.h
)

install (FILES ${HDRS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/src")