This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
207 lines (163 loc) · 7.04 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
# Copyright 2020 IFPEN-CEA
#
# 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.
#
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.18)
cmake_policy(SET CMP0079 NEW)
# MUST be done before call to 'project'
get_cmake_property(vars CACHE_VARIABLES)
foreach (var ${vars})
get_property(currentHelpString CACHE "${var}" PROPERTY HELPSTRING)
if ("${currentHelpString}" MATCHES "No help, variable specified on the command line." OR "${currentHelpString}" STREQUAL "")
# message("${var} = [${${var}}] -- ${currentHelpString}") # uncomment to see the variables being processed
list(APPEND CL_ARGS "-D${var}=${${var}}")
endif ()
endforeach ()
file(READ "version" ALIEN_VERSION_STR_FULL)
string(REPLACE "_dev" "" ALIEN_VERSION ${ALIEN_VERSION_STR_FULL})
string(STRIP "${ALIEN_VERSION}" ALIEN_VERSION) # In case of \n
message(STATUS "AlienVersion = ${ALIEN_VERSION}")
# ----------------------------------------------------------------------------
# Indique que le projet n'a pas de language
# Cela est indispensable pour que CMake ne recherche pas les
# compilateurs avant d'avoir inclus les fichiers de configuration.
Project(Alien
LANGUAGES C CXX
VERSION ${ALIEN_VERSION})
option(ALIEN_COMPONENT_RefSemantic "Whether or not to compile RefSemantic package" ON)
option(ALIEN_COMPONENT_MoveSemantic "Whether or not to compile MoveSemantic package" ON)
option(ALIEN_EXAMPLES "Whether or not to compile examples" ON)
option(ALIEN_BENCHMARKS "Benchmark driver for Alien" ON)
option(ALIEN_UNIT_TESTS "Whether or not to enable unit tests" OFF)
option(ALIEN_EXPAND_TESTS "Run unit tests one by one" OFF)
option(ALIEN_USE_HDF5 "Enable HDF5 export" OFF)
option(ALIEN_USE_LIBXML2 "Enable xml export" OFF)
option(ALIEN_USE_SYCL "Whether or not to compile SYCL backend" OFF)
option(ALIEN_USE_PERF_TIMER "Whether or not to enable perf timer" OFF)
option(ALIEN_WANT_AVX "Whether or not to enable avx flags" OFF)
option(ALIEN_WANT_AVX2 "Whether or not to enable avx2 flags" OFF)
option(ALIEN_WANT_AVX512 "Whether or not to enable avx512 flags" OFF)
option(ALIEN_DEFAULT_OPTIONS "Enable best effort to find optional dependencies" ON)
option(ALIEN_GENERATE_DOCUMENTATION "Generate API documentation" OFF)
option(ALIEN_GENERATE_TUTORIAL "Compile examples of Alien" ON)
option(ALIEN_PLUGIN_HYPRE "Whether or not to compile Hypre backend" OFF)
option(ALIEN_PLUGIN_PETSC "Whether or not to compile PETSc backend" OFF)
option(ALIEN_PLUGIN_TRILINOS "Whether or not to compile Trilinos backend" OFF)
option(ALIEN_PLUGIN_GINKGO "Whether or not to compile Ginkgo backend" OFF)
option(ALIEN_PLUGIN_GINKGO_REF "Whether or not to compile Ginkgo REFERENCE backend" OFF)
option(ALIEN_PLUGIN_GINKGO_OMP "Whether or not to compile Ginkgo OPENMP backend" OFF)
option(ALIEN_PLUGIN_GINKGO_CUDA "Whether or not to compile Ginkgo CUDA backend" OFF)
option(ALIEN_PLUGIN_GINKGO_HIP "Whether or not to compile Ginkgo HIP backend" OFF)
option(ALIEN_PLUGIN_GINKGO_DPCPP "Whether or not to compile DPCPP Ginkgo backend" OFF)
option(ALIENDEV_EMBEDDED "[dev] forbid to compile Arcon and Arccore" OFF)
# Make this conditional.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# For shared libs, needed for Arccore
set(BUILD_SHARED_LIBS ON)
include(GNUInstallDirs)
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
set(ALIEN_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
include(sanitizers)
# First we try to use external arccon and arccore
if (ALIENDEV_EMBEDDED)
if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW) # DOWNLOAD_EXTRACT_TIMESTAMP instead of archive timestamp
endif ()
include(FetchContent)
FetchContent_Declare(
Arccon
URL https://github.com/arcaneframework/framework/releases/download/arccon-v1.5.0/arccon-1.5.0.src.tar.gz
)
FetchContent_Declare(
Arccore
URL https://github.com/arcaneframework/framework/releases/download/arccore-v2.2.0.0/arccore-2.2.0.0.src.tar.gz
)
set(FRAMEWORK_EXPORT_NAME AlienFrameworkTargets)
get_filename_component(_fp_framework "CMake/fake-framework" REALPATH)
if (EXISTS ${_fp_framework})
list(APPEND CMAKE_MODULE_PATH ${_fp_framework})
endif ()
FetchContent_MakeAvailable(Arccon Arccore)
endif ()
find_package(Arccon REQUIRED)
# Only use find package with Arccon
list(APPEND CMAKE_MODULE_PATH ${ARCCON_MODULE_PATH})
find_package(Arccore REQUIRED)
find_package(LibArchive)
if (LibArchive_FOUND)
add_definitions(-DALIEN_USE_LIBARCHIVE)
endif ()
include(GNUInstallDirs)
if (ALIEN_DEFAULT_OPTIONS)
find_package(HDF5 QUIET)
set(ALIEN_USE_HDF5 ${HDF5_FOUND})
find_package(LibXml2 QUIET)
set(ALIEN_USE_LIBXML2 ${LibXml2_FOUND})
find_package(GTest QUIET)
set(ALIEN_UNIT_TESTS ${GTest_FOUND})
endif ()
enable_testing()
if (ALIEN_GENERATE_DOCUMENTATION)
find_package(Doxygen REQUIRED)
# doxygen settings can be set here, prefixed with "DOXYGEN_"
set(DOXYGEN_SOURCE_BROWSER YES)
set(DOXYGEN_EXTRACT_PRIVATE YES)
set(DOXYGEN_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
# For sphinx
set(DOXYGEN_GENERATE_HTML NO)
set(DOXYGEN_GENERATE_XML YES)
endif (ALIEN_GENERATE_DOCUMENTATION)
# ----------------------------------------------------------------------------
# Configure installation layout.
# Layout. This works for all platforms:
# * <prefix>/lib*/cmake/<PROJECT-NAME>
# * <prefix>/lib*/
# * <prefix>/include/
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
# Configuration
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(namespace "Alien::")
if (ALIEN_USE_PERF_TIMER)
add_definitions(-DALIEN_USE_PERF_TIMER)
endif ()
add_subdirectory(src)
if (ALIEN_BENCHMARKS)
add_subdirectory(benchmark)
endif ()
if (ALIEN_PLUGIN_HYPRE)
add_subdirectory(plugins/hypre)
endif (ALIEN_PLUGIN_HYPRE)
if (ALIEN_PLUGIN_PETSC)
add_subdirectory(plugins/petsc)
endif (ALIEN_PLUGIN_PETSC)
if (ALIEN_PLUGIN_TRILINOS)
add_subdirectory(plugins/trilinos)
endif (ALIEN_PLUGIN_TRILINOS)
if (ALIEN_PLUGIN_GINKGO)
add_subdirectory(plugins/ginkgo)
endif (ALIEN_PLUGIN_GINKGO)
if (ALIEN_EXAMPLES)
add_subdirectory(examples)
endif ()
add_subdirectory(docs)
# ----------------------------------------------------------------------------
# Local Variables:
# tab-width: 2
# indent-tabs-mode: nil
# coding: utf-8-with-signature
# End: