SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
platform.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <cinttypes>
11 #include <ciso646> // makes _LIBCPP_VERSION available
12 #include <cstddef> // makes __GLIBCXX__ available
13 
19 // macro cruft
21 #define SEQAN3_STR_HELPER(x) #x
22 #define SEQAN3_STR(x) SEQAN3_STR_HELPER(x)
24 
25 // ============================================================================
26 // C++ standard and features
27 // ============================================================================
28 
29 // C++ standard [required]
30 #ifdef __cplusplus
31  static_assert(__cplusplus >= 201703, "SeqAn3 requires C++17, make sure that you have set -std=c++17.");
32 #else
33 # error "This is not a C++ compiler."
34 #endif
35 
36 #if __has_include(<version>)
37 # include <version>
38 #endif
39 
40 // C++ Concepts [required]
41 #ifdef __cpp_concepts
42 # if __cpp_concepts == 201507 // GCC and Concepts TS
43 # define SEQAN3_CONCEPT concept bool
44 # else
45  static_assert(__cpp_concepts >= 201507, "Your compiler supports Concepts, but the support is not recent enough.");
46 # define SEQAN3_CONCEPT concept
47 # endif
48 #else
49 # error "SeqAn3 requires C++ Concepts, either via the TS (flag: -fconcepts) or via C++20 (flag: -std=c++2a / -std=c++20)."
50 #endif
51 
53 #if defined(__GNUC__) && (__GNUC__ < 10)
54 # define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name, ...) \
55  {expression}; requires concept_name<decltype(expression), __VA_ARGS__>
56 #else
57 # define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name, ...) \
58  {expression} -> concept_name<__VA_ARGS__>
59 #endif
60 
61 // filesystem [required]
62 #if !__has_include(<filesystem>)
63 # if !__has_include(<experimental/filesystem>)
64 # error SeqAn3 requires C++17 filesystem support, but it was not found.
65 # endif
66 #endif
67 
68 // ============================================================================
69 // Dependencies
70 // ============================================================================
71 
72 // SeqAn [required]
73 #if __has_include(<seqan3/version.hpp>)
74 # include <seqan3/version.hpp>
75 #else
76 # error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
77 #endif
78 
79 // Ranges [required]
80 #if __has_include(<range/v3/version.hpp>)
81 # define RANGE_V3_MINVERSION 1100
82 # define RANGE_V3_MAXVERSION 1199
83 // TODO the following doesn't actually show the current version, only its formula. How'd you do it?
84 # define SEQAN3_MSG "Your version: " SEQAN3_STR(RANGE_V3_VERSION) \
85  "; minimum version: " SEQAN3_STR(RANGE_V3_MINVERSION) \
86  "; expected maximum version: " SEQAN3_STR(RANGE_V3_MAXVERSION)
87 # include <range/v3/version.hpp>
88 # if RANGE_V3_VERSION < RANGE_V3_MINVERSION
89 # error Your range-v3 library is too old.
90 # pragma message(SEQAN3_MSG)
91 # elif RANGE_V3_VERSION > RANGE_V3_MAXVERSION
92 # pragma GCC warning "Your range-v3 library is possibly too new. Some features might not work correctly."
93 # pragma message(SEQAN3_MSG)
94 # endif
95 # undef SEQAN3_MSG
96 #else
97 # error The range-v3 library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
98 #endif
99 
100 // SDSL [required]
101 #if __has_include(<sdsl/version.hpp>)
102 # include <sdsl/version.hpp>
103  static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
104 #else
105 # error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
106 #endif
107 
108 // Cereal [optional]
113 #ifndef SEQAN3_WITH_CEREAL
114 # if __has_include(<cereal/cereal.hpp>)
115 # define SEQAN3_WITH_CEREAL 1
116 # else
117 # define SEQAN3_WITH_CEREAL 0
118 # endif
119 #elif SEQAN3_WITH_CEREAL != 0
120 # if ! __has_include(<cereal/cereal.hpp>)
121 # error Cereal was marked as required, but not found!
122 # endif
123 #endif
124 
125 #if !SEQAN3_WITH_CEREAL
134 # define CEREAL_SERIALIZE_FUNCTION_NAME serialize
136 # define CEREAL_LOAD_FUNCTION_NAME load
138 # define CEREAL_SAVE_FUNCTION_NAME save
140 # define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
142 # define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
146 #endif
147 
148 // Lemon [optional]
153 #ifndef SEQAN3_WITH_LEMON
154 # if __has_include(<lemon/config.h>)
155 # define SEQAN3_WITH_LEMON 1
156 # else
157 # define SEQAN3_WITH_LEMON 0
158 # endif
159 #elif SEQAN3_WITH_LEMON != 0
160 # if !__has_include(<lemon/config.h>)
161 # error Lemon was marked as required, but not found!
162 # endif
163 #endif
164 #if SEQAN3_WITH_LEMON == 1
165 # define LEMON_HAVE_LONG_LONG 1
166 # define LEMON_CXX11 1
167 # if defined(__unix__) || defined(__APPLE__)
168 # define LEMON_USE_PTHREAD 1
169 # define LEMON_USE_WIN32_THREADS 0
170 # define LEMON_WIN32 0
171 # else
172 # define LEMON_USE_PTHREAD 0
173 # define LEMON_USE_WIN32_THREADS 1
174 # define LEMON_WIN32 1
175 # endif
176 #endif
177 
178 // TODO (doesn't have a version.hpp, yet)
179 
180 // ============================================================================
181 // Documentation
182 // ============================================================================
183 
184 // Doxygen related
185 // this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
186 #ifndef SEQAN3_DOXYGEN_ONLY
187 # define SEQAN3_DOXYGEN_ONLY(x)
188 #endif
189 
190 // ============================================================================
191 // Deprecation Messages
192 // ============================================================================
193 
195 #ifndef SEQAN3_PRAGMA
196 # define SEQAN3_PRAGMA(non_string_literal) _Pragma(#non_string_literal)
197 #endif
198 
200 #ifndef SEQAN3_REMOVE_DEPRECATED_310
201 # ifndef SEQAN3_DEPRECATED_310
202 # ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
203 # define SEQAN3_DEPRECATED_310 [[deprecated("This will be removed in SeqAn-3.1.0; please see the documentation.")]]
204 # else
205 # define SEQAN3_DEPRECATED_310
206 # endif
207 # endif
208 #endif
209 
211 #ifndef SEQAN3_DEPRECATED_HEADER
212 # ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
213 # define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
214 # else
215 # define SEQAN3_DEPRECATED_HEADER(message)
216 # endif
217 #endif
218 
219 // ============================================================================
220 // Workarounds
221 // ============================================================================
222 
229 #if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
230 # ifdef SEQAN3_DEPRECATED_310
231 # define SEQAN3_WORKAROUND_GCC_93983 0
232 # define SEQAN3_WORKAROUND_GCC_95371 0
233 # define SEQAN3_WORKAROUND_GCC_95578 0
234 # endif // SEQAN3_DEPRECATED_310
235 # pragma GCC warning "Be aware that gcc 10.0 and 10.1 are known to have several bugs that might make SeqAn3 fail to compile. Please use gcc >= 10.2."
236 #endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
237 
238 #ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
240 # define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
241 #endif
242 
244 #ifndef SEQAN3_WORKAROUND_ISSUE_286
245 # if defined(__GNUC__) && (__GNUC__ <= 9)
246 # define SEQAN3_WORKAROUND_ISSUE_286 1
247 # else
248 # define SEQAN3_WORKAROUND_ISSUE_286 0
249 # endif
250 #endif
251 
253 #ifndef SEQAN3_WORKAROUND_GCC_83328
254 # if defined(__GNUC__) && (__GNUC__ <= 8)
255 # define SEQAN3_WORKAROUND_GCC_83328 1
256 # else
257 # define SEQAN3_WORKAROUND_GCC_83328 0
258 # endif
259 #endif
260 
262 #ifndef SEQAN3_WORKAROUND_GCC_87113
263 # if defined(__GNUC_MINOR__) && ((__GNUC__ == 7) || ((__GNUC__ == 8) && (__GNUC_MINOR__ < 3)))
264 # define SEQAN3_WORKAROUND_GCC_87113 1
265 # else
266 # define SEQAN3_WORKAROUND_GCC_87113 0
267 # endif
268 #endif
269 
271 #ifndef SEQAN3_WORKAROUND_GCC_89953
272 # if defined(__GNUC_MINOR__) && (__GNUC__ == 9 && __GNUC_MINOR__ < 3)
273 # define SEQAN3_WORKAROUND_GCC_89953 1
274 # else
275 # define SEQAN3_WORKAROUND_GCC_89953 0
276 # endif
277 #endif
278 
280 #ifndef SEQAN3_WORKAROUND_GCC_90897 // fixed since gcc8.4
281 # if defined(__GNUC__) && (__GNUC__ == 8 && __GNUC_MINOR__ < 4)
282 # define SEQAN3_WORKAROUND_GCC_90897 1
283 # else
284 # define SEQAN3_WORKAROUND_GCC_90897 0
285 # endif
286 #endif
287 
289 #ifndef SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES
290 # if defined(__GNUC__) && ((__GNUC__ == 7) || (__GNUC__ == 8))
291 # define SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES 1
292 # else
293 # define SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES 0
294 # endif
295 #endif
296 
298 #ifndef SEQAN3_WORKAROUND_GCC_93467 // fixed since gcc10.2
299 # if defined(__GNUC__) && ((__GNUC__ <= 9) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2))
300 # define SEQAN3_WORKAROUND_GCC_93467 1
301 # else
302 # define SEQAN3_WORKAROUND_GCC_93467 0
303 # endif
304 #endif
305 
308 #ifndef SEQAN3_WORKAROUND_GCC_94967 // fixed since gcc8
309 # if defined(__GNUC__) && (__GNUC__ <= 7)
310 # define SEQAN3_WORKAROUND_GCC_94967 1
311 # else
312 # define SEQAN3_WORKAROUND_GCC_94967 0
313 # endif
314 #endif
315 
317 #ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
318 # if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
319 # define SEQAN3_WORKAROUND_GCC_96070 1
320 # else
321 # define SEQAN3_WORKAROUND_GCC_96070 0
322 # endif
323 #endif
324 
326 #ifndef SEQAN3_WORKAROUND_GCC_99318 // fixed since gcc10.3
327 # if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 3)
328 # define SEQAN3_WORKAROUND_GCC_99318 1
329 # else
330 # define SEQAN3_WORKAROUND_GCC_99318 0
331 # endif
332 #endif
333 
336 #ifndef SEQAN3_WORKAROUND_GCC_100139 // not yet fixed
337 # if defined(__GNUC__)
338 # define SEQAN3_WORKAROUND_GCC_100139 1
339 # else
340 # define SEQAN3_WORKAROUND_GCC_100139 0
341 # endif
342 #endif
343 
354 #ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
355 # if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
356 # define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
357 # else
358 # define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
359 # endif
360 #endif
361 
362 #if SEQAN3_DOXYGEN_ONLY(1)0
364 #define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
365 #endif // SEQAN3_DOXYGEN_ONLY(1)0
366 
367 #if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
368 # ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
369 # pragma GCC warning "We do not actively support compiler that have -D_GLIBCXX_USE_CXX11_ABI=0 set, and it might be that SeqAn does not compile due to this. It is known that all compiler of CentOS 7 / RHEL 7 set this flag by default (and that it cannot be overridden!). Note that these versions of the OSes are community-supported (see https://docs.seqan.de/seqan/3-master-user/about_api.html#platform_stability for more details). You can disable this warning by setting -DSEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC."
370 # endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
371 #endif // _GLIBCXX_USE_CXX11_ABI == 0
372 
376 #ifndef SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES
377 # if defined(__GNUC_MINOR__) && (__GNUC__ < 10) // fixed since gcc-10
378 # define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 1
379 # else
380 # define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 0
381 # endif
382 #endif
383 
386 #ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
387 # if defined(__GNUC__) && (__GNUC__ < 11)
388 # define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
389 # else
390 # define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
391 # endif
392 #endif
393 
395 #ifndef SEQAN3_WORKAROUND_GCC_INCOMPLETE_FILESYSTEM
396 # if defined(__GNUC__) && (__GNUC__ == 7)
397 # define SEQAN3_WORKAROUND_GCC_INCOMPLETE_FILESYSTEM 1
398 # else
399 # define SEQAN3_WORKAROUND_GCC_INCOMPLETE_FILESYSTEM 0
400 # endif
401 #endif
402 
403 
404 // ============================================================================
405 // Backmatter
406 // ============================================================================
407 
408 // macro cruft undefine
409 #undef SEQAN3_STR
410 #undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.