-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
275 lines (230 loc) · 10.8 KB
/
CMakeLists.txt
File metadata and controls
275 lines (230 loc) · 10.8 KB
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
################################################################################
#
# This file is part of the Geneva library collection. The following license
# applies to this file:
#
# ------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------------
#
# Note that other files in the Geneva library collection may use a different
# license. Please see the licensing information in each file.
#
################################################################################
#
# Geneva was started by Dr. Rüdiger Berlich and was later maintained together
# with Dr. Ariel Garcia under the auspices of Gemfony scientific. For further
# information on Gemfony scientific, see http://www.gemfomy.eu .
#
# The majority of files in Geneva was released under the Apache license v2.0
# in February 2020.
#
# See the NOTICE file in the top-level directory of the Geneva library
# collection for a list of contributors and copyright information.
#
################################################################################
CMAKE_MINIMUM_REQUIRED(VERSION 3.27 FATAL_ERROR)
MESSAGE ("")
PROJECT (Geneva_Library_Collection LANGUAGES CXX CUDA)
################################################################################
# We create some examples and test programs as part of the build process.
# This variable allows their build-scripts to detect that they are being
# called from within the master build-script. This prevents redundant searches
# and checks, while still allowing examples to be built independently of the
# main Geneva source tree.
SET(GENEVA_FULL_TREE_BUILD TRUE)
################################################################################
# Set these variables to make all examples and/or benchmarks run as part of the
# testing with CTest.
# NOTE: Not yet functional
SET(GENEVA_RUN_EXAMPLES_AS_TESTS FALSE)
SET(GENEVA_RUN_BENCHMARKS_AS_TESTS FALSE)
################################################################################
# Different subcomponents of the Geneva binary tree can be installed in
# customized locations, by setting the "INSTALL_PREFIX_*" variables:
# INSTALL_PREFIX_INCLUDES -> installation folder for the header files
# INSTALL_PREFIX_LIBS -> installation folder for the libraries
# INSTALL_PREFIX_DOCS -> installation folder for the documentation files
# INSTALL_PREFIX_DATA -> installation folder for other files like
# examples, tests and other scripts
# If none of these variables is set, the whole Geneva binary tree is installed
# (as expected) in "CMAKE_INSTALL_PREFIX". The default value for this last
# valiable is set here, and further handled in the 'CommonGenevaBuild' module.
# Generally, this can be provided through a custom genevaConfig.gcfg, in
# conjunction with the prepareBuild.sh script.
IF( NOT CMAKE_INSTALL_PREFIX )
SET( INSTALL_PREFIX_ROOT "/opt/geneva-${GENEVA_VERSION}" )
ENDIF()
################################################################################
# Make sure we first check our local modules directory
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules")
################################################################################
# Set preprocessor define to use in source code if building with MPI consumer
IF (GENEVA_BUILD_WITH_MPI_CONSUMER)
ADD_COMPILE_DEFINITIONS(GENEVA_BUILD_WITH_MPI_CONSUMER)
ENDIF ()
###############################################################################
# Include the shared functionality module for any Geneva build
INCLUDE(CommonGenevaBuild)
###############################################################################
# Set the library/package version. Uneven minor numbers denote development
# versions while even minor numbers stand for production releases.
SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "11")
SET(VERSION_PATCH "0")
SET(GENEVA_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
################################################################################
# Include directories, libraries
INCLUDE_DIRECTORIES (
${PROJECT_SOURCE_DIR}/include
)
# Custom targets for building single libraries only
ADD_CUSTOM_TARGET( "common" DEPENDS ${COMMON_LIBNAME} COMMENT "Building only the Common library." )
ADD_CUSTOM_TARGET( "hap" DEPENDS ${HAP_LIBNAME} COMMENT "Building only the Hap library." )
ADD_CUSTOM_TARGET( "courtier" DEPENDS ${COURTIER_LIBNAME} COMMENT "Building only the Courtier library." )
ADD_CUSTOM_TARGET( "geneva" DEPENDS ${GENEVA_LIBNAME} COMMENT "Building only the Geneva library." )
ADD_CUSTOM_TARGET( "geneva-individuals" DEPENDS ${GENEVA_INDIVIDUAL_LIBNAME} COMMENT "Building only the Geneva-Individuals library." )
# Custom target for building all the libraries but no examples nor tests
ADD_CUSTOM_TARGET( "core" DEPENDS ${GENEVA_LIBNAMES} COMMENT "Building all the Geneva libraries.")
################################################################################
# Add sub-directories
# Accessory files just get copied
ADD_SUBDIRECTORY (CMakeModules)
ADD_SUBDIRECTORY (licenses)
ADD_SUBDIRECTORY (scripts)
# The main code lays here, and the compilation takes place in 'src'
ADD_SUBDIRECTORY (include)
ADD_SUBDIRECTORY (src)
# Examples and tests are compiled at the end
IF( GENEVA_BUILD_TESTS )
INCLUDE(CTest)
ADD_SUBDIRECTORY (tests)
ENDIF()
# Examples are also run as tests if enabled with 'GENEVA_RUN_EXAMPLES_AS_TESTS'
IF( GENEVA_BUILD_EXAMPLES )
ADD_SUBDIRECTORY (examples)
ENDIF()
# Benchmarks are also run as tests if enabled with GENEVA_RUN_BENCHMARKS_AS_TESTS
IF( GENEVA_BUILD_BENCHMARKS )
ADD_SUBDIRECTORY (benchmarks)
ENDIF()
# Holds an incubator facility for new optimization algorithms
# ADD_SUBDIRECTORY (incubator)
################################################################################
# Custom target for all compilable items in the distribution
ADD_CUSTOM_TARGET(
"gemfony-build-all" DEPENDS
core
benchmarks
examples
tests
# incubator
COMMENT "Build the entire Gemfony library collection"
)
################################################################################
# Custom target for all compilable items in the distribution
ADD_CUSTOM_TARGET(
"install_gemfony-build-all"
"${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target install
DEPENDS gemfony-build-all
COMMENT "Installing gemfony-build-all"
)
################################################################################
# Additional information files to be copied
SET ( INFORMATIONFILES
CHANGES
FAQ
INSTALL
LICENSE
NOTICE
README
README.documentation
)
INSTALL ( FILES ${INFORMATIONFILES} DESTINATION ${INSTALL_PREFIX_DOCS} )
################################################################################
# Code for the creation of reference documentation for Geneva
#
FIND_PACKAGE(Doxygen)
IF( DOXYGEN_FOUND )
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
ADD_CUSTOM_TARGET (
doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Creation of reference documentation for Geneva with 'make doc'" VERBATIM
)
SET(MSG "Reference documentation for Geneva may now be created with 'make doc'")
ELSE()
SET(MSG "Doxygen not found. No support for the creation of reference documentation")
ENDIF()
MESSAGE("${MSG}\n")
################################################################################
# Code for package generation with CPack. This is experimental and the packages
# don't satisfy the Linux FHS yet. Use with care.
#
# RPM or DEB packages can be created using umask 022 && fakeroot make package.
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_NAME "geneva-opt")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Geneva optimization library")
# The package description. Indentation is important!
SET(CPACK_AUX_PACKAGE_DESCRIPTION
"This is the Geneva optimization library. As the name suggests --it stands for
'Grid-enabled evolutionary algorithms'--, Geneva aims to provide the necessary
tools to perform parametric optimization in parallel on devices ranging from
multi-processor machines over clusters all the way to Grids and Cloud installations.
Geneva does not want to be the fastest library of evolutionary algorithms on
single-processor machines, but is instead targeted at large scale problems,
where the evaluation of a single candidate solution will typically take longer
than a few seconds."
)
SET(CPACK_PACKAGE_VENDOR "Gemfony scientific")
SET(CPACK_PACKAGE_CONTACT "Gemfony scientific <contact (AT) gemfony (DOT) eu>")
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
SET(CPACK_PACKAGING_INSTALL_PREFIX "/opt/geneva")
# DEB specific variables. Indentation is important in the description!
SET(
CPACK_DEBIAN_PACKAGE_DESCRIPTION
"${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n ${CPACK_AUX_PACKAGE_DESCRIPTION}"
)
SET(CPACK_DEBIAN_PACKAGE_SECTION "Science")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "Extra")
SET(
CPACK_DEBIAN_PACKAGE_DEPENDS
"libboost-dev (>= ${GENEVA_MIN_BOOST_VERSION}.0),
libboost-filesystem-dev (>= ${GENEVA_MIN_BOOST_VERSION}.0),
libboost-program-options-dev (>= ${GENEVA_MIN_BOOST_VERSION}.0),
libboost-regex-dev (>= ${GENEVA_MIN_BOOST_VERSION}.0),
libboost-serialization-dev (>= ${GENEVA_MIN_BOOST_VERSION}.0),
libboost-system-dev (>= ${GENEVA_MIN_BOOST_VERSION}.0),
libboost-test-dev (>= ${GENEVA_MIN_BOOST_VERSION}.0)"
)
# RPM specific variables
SET(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_AUX_PACKAGE_DESCRIPTION})
SET(CPACK_RPM_PACKAGE_LICENSE "Apache License 2.0")
SET(CPACK_RPM_PACKAGE_GROUP "Sciences/Libraries")
SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= ${GENEVA_MIN_BOOST_VERSION}")
# Detect the distribution to autos-elect the package generator...
EXECUTE_PROCESS(COMMAND lsb_release -is
OUTPUT_VARIABLE CPACK_AUX_DISTRO
)
IF(CPACK_AUX_DISTRO MATCHES "^Debian" OR CPACK_AUX_DISTRO MATCHES "^Ubuntu")
SET(CPACK_GENERATOR "DEB")
ELSE(CPACK_AUX_DISTRO MATCHES "^RedHat" OR CPACK_AUX_DISTRO MATCHES "^CentOS" OR
CPACK_AUX_DISTRO MATCHES "^Scientific" OR CPACK_AUX_DISTRO MATCHES "^SUSE" )
SET(CPACK_GENERATOR "RPM")
ENDIF()
INCLUDE(CPack)
################################################################################
# Done