-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
222 lines (179 loc) · 7.69 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#------------------------------------------------------------------------------#
# Copyright (c) 2023, Triad National Security, LLC.
# All rights reserved.
#------------------------------------------------------------------------------#
cmake_minimum_required(VERSION 3.19)
#------------------------------------------------------------------------------#
# Add local module path.
#------------------------------------------------------------------------------#
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
#------------------------------------------------------------------------------#
# CMake policies.
#------------------------------------------------------------------------------#
cmake_policy(SET CMP0144 NEW) # ``PACKAGE_NAME''_ROOT
#------------------------------------------------------------------------------#
# Project.
#------------------------------------------------------------------------------#
project(HARD LANGUAGES C CXX)
set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(default_build_type "Debug")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS
"Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
#------------------------------------------------------------------------------#
# Find the FleCSI package. This must be done early so that the FleCSI cmake
# packages will be available to the project, e.g., 'include(FleCSI/sphinx)'.
#
# CMake documentation for FleCSI client applications is included in the
# FleCSI userguide.
#------------------------------------------------------------------------------#
if(NOT FleCSI_FOUND)
find_package(FleCSI 2 REQUIRED)
endif()
#------------------------------------------------------------------------------#
# Yaml
#------------------------------------------------------------------------------#
find_package(yaml-cpp REQUIRED)
#------------------------------------------------------------------------------#
# Catalyst
#------------------------------------------------------------------------------#
option(ENABLE_CATALYST "Enable Catalyst output" OFF)
if(ENABLE_CATALYST)
find_package(catalyst REQUIRED)
endif()
#------------------------------------------------------------------------------#
# Control-Model Output
#------------------------------------------------------------------------------#
option(HARD_WRITE_CONTROL_INFO
"Output the control model graph and actions at startup" OFF)
mark_as_advanced(HARD_WRITE_CONTROL_INFO)
#------------------------------------------------------------------------------#
# Benchmark Mode
#------------------------------------------------------------------------------#
option(HARD_BENCHMARK_MODE
"Benchmark mode disables I/O and adds time measurement" OFF)
mark_as_advanced(HARD_BENCHMARK_MODE)
#------------------------------------------------------------------------------#
# Benchmark Mode
#------------------------------------------------------------------------------#
option(HARD_ENABLE_LEGION_TRACING
"Enable Legion Tracing" OFF)
mark_as_advanced(HARD_ENABLE_LEGION_TRACING)
#------------------------------------------------------------------------------#
# Disable Radiation
#------------------------------------------------------------------------------#
option(DISABLE_RADIATION
"Disables radiation in evolution" OFF)
mark_as_advanced(DISABLE_RADIATION)
#------------------------------------------------------------------------------#
# Formatting
#------------------------------------------------------------------------------#
option(ENABLE_FORMAT "Enable format target" OFF)
mark_as_advanced(ENABLE_FORMAT)
if(ENABLE_FORMAT)
include(format)
set(CLANG_FORMAT_VERSION "13...<14" CACHE STRING
"Set the required version (major[.minor[.patch]]) of clang-format")
mark_as_advanced(CLANG_FORMAT_VERSION)
flecsi_add_format_target(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}
"${CLANG_FORMAT_VERSION}")
endif()
#------------------------------------------------------------------------------#
# Documentation
#------------------------------------------------------------------------------#
option(ENABLE_DOCUMENTATION "Enable documentation" OFF)
mark_as_advanced(ENABLE_DOCUMENTATION)
if(ENABLE_DOCUMENTATION)
#----------------------------------------------------------------------------#
# README.md figure
#----------------------------------------------------------------------------#
find_package(LATEX REQUIRED)
find_program(PDFTOPPM_EXECUTABLE pdftoppm PATHS /usr/bin)
add_custom_target(structure
COMMAND
${PDFLATEX_COMPILER} ${PROJECT_SOURCE_DIR}/doc/tex/structure.tex &&
${PDFTOPPM_EXECUTABLE} -jpeg structure.pdf > structure.jpg
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
#----------------------------------------------------------------------------#
# Sphinx & Doxygen
#----------------------------------------------------------------------------#
include(FleCSI/doxygen)
include(FleCSI/sphinx)
# Avoid race condition by proactively creating output directory
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/.doxygen/xml)
flecsi_add_doxygen_target(hard
CONFIGS
${CMAKE_SOURCE_DIR}/doc/doxygen/hard.conf.in
${CMAKE_SOURCE_DIR}/doc/doxygen/conf.in
)
file(COPY ${CMAKE_SOURCE_DIR}/doc/sphinx
DESTINATION ${CMAKE_BINARY_DIR}
)
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/.sphinx)
file(RENAME ${CMAKE_BINARY_DIR}/sphinx
${CMAKE_BINARY_DIR}/.sphinx
)
# Create output directory
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/.sphinx/hard/src)
execute_process(COMMAND
${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/spec
${CMAKE_BINARY_DIR}/.sphinx/hard/src/spec
)
execute_process(COMMAND
${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/app
${CMAKE_BINARY_DIR}/.sphinx/hard/src/app
)
flecsi_add_sphinx_target(main
CONFIG ${CMAKE_BINARY_DIR}/.sphinx
OUTPUT ${CMAKE_BINARY_DIR}/doc
)
find_package(Git REQUIRED)
add_custom_target(deploy-doc
COMMAND
make doc &&
echo "Updating pages" &&
([ -e pages ] ||
${GIT_EXECUTABLE} clone -q --single-branch --branch pages
[email protected]:cdss24/hard.git pages &&
cd pages &&
${GIT_EXECUTABLE} rm -qr . && ${GIT_EXECUTABLE} reset -q &&
${GIT_EXECUTABLE} checkout .gitignore &&
${GIT_EXECUTABLE} checkout .gitlab-ci.yml) &&
echo "Updating pages" &&
cp -rT doc pages/public &&
(cd pages && ${GIT_EXECUTABLE} add -A .) &&
echo "Updated pages are in ${CMAKE_BINARY_DIR}/pages"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
#------------------------------------------------------------------------------#
# Testing
#------------------------------------------------------------------------------#
option(ENABLE_UNIT_TESTS "Enable unit tests" OFF)
mark_as_advanced(ENABLE_UNIT_TESTS)
if(ENABLE_UNIT_TESTS)
include(FleCSI/unit)
enable_testing()
endif()
#------------------------------------------------------------------------------#
# Add library.
#------------------------------------------------------------------------------#
add_library(Spec INTERFACE)
add_library(Spec::Spec ALIAS Spec)
target_include_directories(Spec
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
add_subdirectory(spec)
#------------------------------------------------------------------------------#
# Add apps.
#------------------------------------------------------------------------------#
add_subdirectory(app)