forked from PartExa/PartExa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
98 lines (82 loc) · 2.87 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
## ---------------------------------------------------------------------
##
## PartExa - A Particle Library for the Exa-Scale
##
## Copyright (C) 2021 by the PartExa authors
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <https://www.gnu.org/licenses/>.
##
## ---------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 3.12.0)
ADD_SUBDIRECTORY(cmake)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
PRINT_PARTEXA_HEADER()
# deal.II
FIND_PACKAGE(
deal.II 9.4.0 QUIET
HINTS ${deal.II_DIR} ${DEAL_II_DIR} $ENV{DEAL_II_DIR}
)
IF(NOT ${deal.II_FOUND})
MESSAGE(
FATAL_ERROR
"\n"
"*** Could not locate a (sufficiently recent) version of deal.II. ***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this path."
)
ENDIF()
# p4est
IF(NOT DEAL_II_WITH_P4EST)
MESSAGE(
FATAL_ERROR
"\n"
"*** deal.II was configured without DEAL_II_WITH_P4EST enabled. ***\n\n"
"You may want to provide another deal.II installation with flag -DDEAL_II_WITH_P4EST=ON."
)
ENDIF()
DEAL_II_INITIALIZE_CACHED_VARIABLES()
DEAL_II_QUERY_GIT_INFORMATION(PARTEXA)
MESSAGE("--")
MESSAGE("-- PartExa branch: " ${PARTEXA_GIT_BRANCH})
MESSAGE("-- PartExa hash: " ${PARTEXA_GIT_REVISION})
MESSAGE("--")
MESSAGE("-- deal.II branch: " ${DEAL_II_GIT_BRANCH})
MESSAGE("-- deal.II hash: " ${DEAL_II_GIT_REVISION})
MESSAGE("--")
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/include/partexa/base/revision.h.in
${CMAKE_BINARY_DIR}/include/partexa/base/revision.h
)
PROJECT(partexa)
INCLUDE_DIRECTORIES(include ${CMAKE_BINARY_DIR}/include)
ADD_LIBRARY(partexa
source/dummy.cc
)
DEAL_II_SETUP_TARGET(partexa)
# define release and debug build types
ADD_CUSTOM_TARGET(debug
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
)
ADD_CUSTOM_TARGET(release
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
COMMENT "Switch CMAKE_BUILD_TYPE to Release"
)
# enable documentation
ADD_SUBDIRECTORY(doc)
# enable testing framework
ENABLE_TESTING()
ADD_SUBDIRECTORY(tests)