-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
111 lines (90 loc) · 2.92 KB
/
CMakeLists.txt
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
cmake_minimum_required(VERSION 2.8)
project(stella)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(cxx11)
include(cxx_config)
include(testing)
option(ENABLE_UNIT_TESTS "Enable unit testing" OFF)
option(AutodetectMPI "Automatically detect MPI" ON)
option(ENABLE_CEDAR "Enable Cedar solver" OFF)
enable_language(C CXX Fortran)
find_package(PETSc REQUIRED)
set(req-lib ${PETSC_LIBRARIES} m)
set(req-inc ${PETSC_INCLUDES})
set(req-def "")
if(NOT (${PETSC_VERSION} VERSION_LESS 3.7.0))
list(APPEND req-def PETSC_OPTIONS_TAKES_DATABASE)
endif()
if(AutodetectMPI)
find_package(MPI REQUIRED)
list(APPEND req-lib ${MPI_C_LIBRARIES})
list(APPEND req-inc ${MPI_C_INCLUDE_PATH})
endif()
if(ENABLE_CEDAR)
find_package(cedar REQUIRED)
list(APPEND req-inc ${CEDAR_INCLUDE_DIR})
list(APPEND req-lib cedar)
list(APPEND req-def WITH_CEDAR)
endif()
include_directories(src)
if(ENABLE_UNIT_TESTS)
add_subdirectory(test)
endif()
add_subdirectory(src)
add_library(stella ${stella_sources})
target_compile_definitions(stella PUBLIC ${req-def})
target_link_libraries(stella PUBLIC ${req-lib})
target_include_directories(stella PUBLIC ${req-inc})
add_subdirectory(tools)
# Set the Doxygen list
set(list_for_doxygen_headers
"src/stella_bc.h"
"src/stella_boundary.h"
"src/stella_classify.h"
"src/stella_dirichlet.h"
"src/stella_dmap.h"
"src/stella_fd.h"
"src/stella_gen.h"
"src/stella_grid.h"
"src/stella_io.h"
"src/stella_level.h"
"src/stella_mat.h"
"src/stella_metric.h"
"src/stella_neumann.h"
"src/stella_operator.h"
"src/stella_pc.h"
"src/stella_rhs.h"
"src/stella_signals.h"
"src/stella_solver.h"
"src/stella_state.h"
"src/stella_stencil.h"
"tools/single-block/base.h"
"tools/single-block/block.h"
"tools/single-block/boundary.h"
"tools/single-block/grid.h"
"tools/single-block/map.h"
"tools/single-block/option.h"
"tools/single-block/problem.h"
"tools/single-block/solver.h"
"tools/single-block/state.h"
)
foreach(arg ${list_for_doxygen_headers})
set(doxygen_headers "${doxygen_headers} ${CMAKE_CURRENT_SOURCE_DIR}/${arg}")
endforeach(arg ${list_for_doxygen_headers})
# build documentation (if enabled)
option(DOC "Create and install the HTML based API documentation (requires Doxygen)" ON)
if(DOC)
find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen is needed to build the documentation.")
endif()
set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile)
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.bin)
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION share/doc/stella OPTIONAL)
endif()