-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
332 lines (297 loc) · 14.7 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
#****************************************************************************
# Evo2Sim (Evolution of Evolution Simulator)
# -------------------------------------------
# Digital evolution model dedicated to
# bacterial in silico experimental evolution.
#
# Copyright (C) 2014-2021 Charles Rocabert, Carole Knibbe, Guillaume Beslon
# Web: https://github.com/charlesrocabert/Evo2Sim
#
# 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 <http://www.gnu.org/licenses/>.
#****************************************************************************
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Define the minimum required CMake version #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
cmake_minimum_required(VERSION 2.6)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Define the project name #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
project(EVO2SIM)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Define the package name #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
set(PACKAGE "\"Evo2Sim\"")
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Define the version number #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
set(VERSION_MAJOR 1)
set(VERSION_MINOR 1)
set(VERSION_PATCH 0)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set other options #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
set(AB_POST_TREATMENTS 1)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Add definitions to CXX flags #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
ADD_DEFINITIONS(-std=c++11)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set DEBUG and RELEASE flags #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -g -Wall -Wextra -pedantic")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -O2 -Wall -Wextra -pedantic")
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Define the modules path #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Define the executables output path #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
set(EXECUTABLE_OUTPUT_PATH ../build/bin)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Define the executables #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
set(CREATE_EXECUTABLE evo2sim_create)
add_executable(${CREATE_EXECUTABLE} src/evo2sim_create.cpp)
set(BOOTSTRAP_EXECUTABLE evo2sim_bootstrap)
add_executable(${BOOTSTRAP_EXECUTABLE} src/evo2sim_bootstrap.cpp)
set(RUN_EXECUTABLE evo2sim_run)
add_executable(${RUN_EXECUTABLE} src/evo2sim_run.cpp)
set(GENERATE_FIGURES_EXECUTABLE evo2sim_generate_figures)
add_executable(${GENERATE_FIGURES_EXECUTABLE} src/evo2sim_generate_figures.cpp)
set(PARAMETERS_EXECUTABLE evo2sim_recover_parameters)
add_executable(${PARAMETERS_EXECUTABLE} src/evo2sim_recover_parameters.cpp)
set(UNITARY_TESTS_EXECUTABLE evo2sim_unitary_tests)
add_executable(${UNITARY_TESTS_EXECUTABLE} src/evo2sim_unitary_tests.cpp)
set(INTEGRATED_TESTS_EXECUTABLE evo2sim_integrated_tests)
add_executable(${INTEGRATED_TESTS_EXECUTABLE} src/evo2sim_integrated_tests.cpp)
### AB post treatments ###
if(AB_POST_TREATMENTS)
set(AB_STATISTICS_EXECUTABLE evo2sim_AB_recover_statistics)
add_executable(${AB_STATISTICS_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_recover_statistics.cpp)
set(AB_DIVERSITY_EXECUTABLE evo2sim_AB_phylogenetic_diversity)
add_executable(${AB_DIVERSITY_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_phylogenetic_diversity.cpp)
set(AB_GROUPS_HISTORY_EXECUTABLE evo2sim_AB_trophic_groups_history)
add_executable(${AB_GROUPS_HISTORY_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_trophic_groups_history.cpp)
set(AB_BLACK_QUEEN_EXECUTABLE evo2sim_AB_black_queen)
add_executable(${AB_BLACK_QUEEN_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_black_queen.cpp)
set(AB_FREQ_DEP_EXECUTABLE evo2sim_AB_frequency_dependence)
add_executable(${AB_FREQ_DEP_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_frequency_dependence.cpp)
set(AB_COMPETITION_EXECUTABLE evo2sim_AB_run_competition_experiment)
add_executable(${AB_COMPETITION_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_run_competition_experiment.cpp)
set(AB_LAST_INDIVIDUALS_EXECUTABLE evo2sim_AB_last_individuals)
add_executable(${AB_LAST_INDIVIDUALS_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_last_individuals.cpp)
set(AB_TROPHIC_STATISTICS_EXECUTABLE evo2sim_AB_recover_trophic_statistics)
add_executable(${AB_TROPHIC_STATISTICS_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_recover_trophic_statistics.cpp)
set(AB_HEATMAPS_EXECUTABLE evo2sim_AB_recover_metabolic_heatmaps)
add_executable(${AB_HEATMAPS_EXECUTABLE} src/AB_post_treatments/evo2sim_AB_recover_metabolic_heatmaps.cpp)
endif(AB_POST_TREATMENTS)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Find and link external libraries #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
find_package(GSL REQUIRED)
if(GSL_FOUND)
include_directories(${GSL_INCLUDE_DIR})
target_link_libraries(${CREATE_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${BOOTSTRAP_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${RUN_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${GENERATE_FIGURES_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${PARAMETERS_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${UNITARY_TESTS_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${INTEGRATED_TESTS_EXECUTABLE} ${GSL_LIBRARIES})
if(AB_POST_TREATMENTS)
target_link_libraries(${AB_STATISTICS_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${AB_DIVERSITY_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${AB_GROUPS_HISTORY_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${AB_BLACK_QUEEN_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${AB_FREQ_DEP_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${AB_COMPETITION_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${AB_LAST_INDIVIDUALS_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${AB_TROPHIC_STATISTICS_EXECUTABLE} ${GSL_LIBRARIES})
target_link_libraries(${AB_HEATMAPS_EXECUTABLE} ${GSL_LIBRARIES})
endif(AB_POST_TREATMENTS)
endif(GSL_FOUND)
find_package(ZLIB REQUIRED)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
target_link_libraries(${CREATE_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${BOOTSTRAP_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${RUN_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${GENERATE_FIGURES_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${PARAMETERS_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${UNITARY_TESTS_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${INTEGRATED_TESTS_EXECUTABLE} ${ZLIB_LIBRARIES})
if(AB_POST_TREATMENTS)
target_link_libraries(${AB_STATISTICS_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${AB_DIVERSITY_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${AB_GROUPS_HISTORY_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${AB_BLACK_QUEEN_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${AB_FREQ_DEP_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${AB_COMPETITION_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${AB_LAST_INDIVIDUALS_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${AB_TROPHIC_STATISTICS_EXECUTABLE} ${ZLIB_LIBRARIES})
target_link_libraries(${AB_HEATMAPS_EXECUTABLE} ${ZLIB_LIBRARIES})
endif(AB_POST_TREATMENTS)
endif(ZLIB_FOUND)
if(WITH_GRAPHICS_CONTEXT)
find_package(SFML 2 REQUIRED graphics window system)
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${CREATE_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${BOOTSTRAP_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${RUN_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${GENERATE_FIGURES_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${PARAMETERS_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${UNITARY_TESTS_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${INTEGRATED_TESTS_EXECUTABLE} ${SFML_LIBRARIES})
if(AB_POST_TREATMENTS)
target_link_libraries(${AB_STATISTICS_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${AB_DIVERSITY_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${AB_GROUPS_HISTORY_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${AB_BLACK_QUEEN_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${AB_FREQ_DEP_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${AB_COMPETITION_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${AB_LAST_INDIVIDUALS_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${AB_TROPHIC_STATISTICS_EXECUTABLE} ${SFML_LIBRARIES})
target_link_libraries(${AB_HEATMAPS_EXECUTABLE} ${SFML_LIBRARIES})
endif(AB_POST_TREATMENTS)
endif(SFML_FOUND)
endif(WITH_GRAPHICS_CONTEXT)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Create and link Evo2Sim library #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
if(WITH_GRAPHICS_CONTEXT)
add_library(
Evo2Sim
src/lib/Cell.cpp
src/lib/Cell.h
src/lib/Enums.h
src/lib/Environment.cpp
src/lib/Environment.h
src/lib/Genome.cpp
src/lib/Genome.h
src/lib/GraphicDisplay.cpp
src/lib/GraphicDisplay.h
src/lib/InheritedProteins.cpp
src/lib/InheritedProteins.h
src/lib/IntegratedTests.cpp
src/lib/IntegratedTests.h
src/lib/Macros.h
src/lib/MutationEvent.cpp
src/lib/MutationEvent.h
src/lib/MutationVector.cpp
src/lib/MutationVector.h
src/lib/Node.cpp
src/lib/Node.h
src/lib/ODE.cpp
src/lib/ODE.h
src/lib/Parameters.cpp
src/lib/Parameters.h
src/lib/Population.cpp
src/lib/Population.h
src/lib/Prng.cpp
src/lib/Prng.h
src/lib/ReplicationReport.cpp
src/lib/ReplicationReport.h
src/lib/Simulation.cpp
src/lib/Simulation.h
src/lib/SpeciesList.cpp
src/lib/SpeciesList.h
src/lib/Statistics.cpp
src/lib/Statistics.h
src/lib/Structs.h
src/lib/Tree.cpp
src/lib/Tree.h
src/lib/TrophicGroup.cpp
src/lib/TrophicGroup.h
src/lib/TrophicNetwork.cpp
src/lib/TrophicNetwork.h
src/lib/UnitaryTests.cpp
src/lib/UnitaryTests.h
)
elseif(NOT WITH_GRAPHICS_CONTEXT)
add_library(
Evo2Sim
src/lib/Cell.cpp
src/lib/Cell.h
src/lib/Enums.h
src/lib/Environment.cpp
src/lib/Environment.h
src/lib/Genome.cpp
src/lib/Genome.h
src/lib/InheritedProteins.cpp
src/lib/InheritedProteins.h
src/lib/IntegratedTests.cpp
src/lib/IntegratedTests.h
src/lib/Macros.h
src/lib/MutationEvent.cpp
src/lib/MutationEvent.h
src/lib/MutationVector.cpp
src/lib/MutationVector.h
src/lib/Node.cpp
src/lib/Node.h
src/lib/ODE.cpp
src/lib/ODE.h
src/lib/Parameters.cpp
src/lib/Parameters.h
src/lib/Population.cpp
src/lib/Population.h
src/lib/Prng.cpp
src/lib/Prng.h
src/lib/ReplicationReport.cpp
src/lib/ReplicationReport.h
src/lib/Simulation.cpp
src/lib/Simulation.h
src/lib/SpeciesList.cpp
src/lib/SpeciesList.h
src/lib/Statistics.cpp
src/lib/Statistics.h
src/lib/Structs.h
src/lib/Tree.cpp
src/lib/Tree.h
src/lib/TrophicGroup.cpp
src/lib/TrophicGroup.h
src/lib/TrophicNetwork.cpp
src/lib/TrophicNetwork.h
src/lib/UnitaryTests.cpp
src/lib/UnitaryTests.h
)
endif(WITH_GRAPHICS_CONTEXT)
target_link_libraries(Evo2Sim z gsl gslcblas)
target_link_libraries(${CREATE_EXECUTABLE} Evo2Sim)
target_link_libraries(${BOOTSTRAP_EXECUTABLE} Evo2Sim)
target_link_libraries(${RUN_EXECUTABLE} Evo2Sim)
target_link_libraries(${GENERATE_FIGURES_EXECUTABLE} Evo2Sim)
target_link_libraries(${PARAMETERS_EXECUTABLE} Evo2Sim)
target_link_libraries(${UNITARY_TESTS_EXECUTABLE} Evo2Sim)
target_link_libraries(${INTEGRATED_TESTS_EXECUTABLE} Evo2Sim)
if(AB_POST_TREATMENTS)
target_link_libraries(${AB_STATISTICS_EXECUTABLE} Evo2Sim)
target_link_libraries(${AB_DIVERSITY_EXECUTABLE} Evo2Sim)
target_link_libraries(${AB_GROUPS_HISTORY_EXECUTABLE} Evo2Sim)
target_link_libraries(${AB_BLACK_QUEEN_EXECUTABLE} Evo2Sim)
target_link_libraries(${AB_FREQ_DEP_EXECUTABLE} Evo2Sim)
target_link_libraries(${AB_COMPETITION_EXECUTABLE} Evo2Sim)
target_link_libraries(${AB_LAST_INDIVIDUALS_EXECUTABLE} Evo2Sim)
target_link_libraries(${AB_TROPHIC_STATISTICS_EXECUTABLE} Evo2Sim)
target_link_libraries(${AB_HEATMAPS_EXECUTABLE} Evo2Sim)
endif(AB_POST_TREATMENTS)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Build the Config.h file #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/modules/Config.h.in"
"${PROJECT_BINARY_DIR}/Config.h"
)
include_directories("${PROJECT_BINARY_DIR}")