SeqAn3  3.1.0-rc.1
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_DEPRECATED_HEADER
201 # ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
202 # define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
203 # else
204 # define SEQAN3_DEPRECATED_HEADER(message)
205 # endif
206 #endif
207 
208 // ============================================================================
209 // Workarounds
210 // ============================================================================
211 
218 #if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
219 # 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."
220 #endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
221 
222 #ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
224 # define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
225 #endif
226 
228 #ifndef SEQAN3_WORKAROUND_ISSUE_286
229 # if defined(__GNUC__) && (__GNUC__ <= 9)
230 # define SEQAN3_WORKAROUND_ISSUE_286 1
231 # else
232 # define SEQAN3_WORKAROUND_ISSUE_286 0
233 # endif
234 #endif
235 
237 #ifndef SEQAN3_WORKAROUND_GCC_83328
238 # if defined(__GNUC__) && (__GNUC__ <= 8)
239 # define SEQAN3_WORKAROUND_GCC_83328 1
240 # else
241 # define SEQAN3_WORKAROUND_GCC_83328 0
242 # endif
243 #endif
244 
246 #ifndef SEQAN3_WORKAROUND_GCC_87113
247 # if defined(__GNUC_MINOR__) && ((__GNUC__ == 7) || ((__GNUC__ == 8) && (__GNUC_MINOR__ < 3)))
248 # define SEQAN3_WORKAROUND_GCC_87113 1
249 # else
250 # define SEQAN3_WORKAROUND_GCC_87113 0
251 # endif
252 #endif
253 
255 #ifndef SEQAN3_WORKAROUND_GCC_89953
256 # if defined(__GNUC_MINOR__) && (__GNUC__ == 9 && __GNUC_MINOR__ < 3)
257 # define SEQAN3_WORKAROUND_GCC_89953 1
258 # else
259 # define SEQAN3_WORKAROUND_GCC_89953 0
260 # endif
261 #endif
262 
264 #ifndef SEQAN3_WORKAROUND_GCC_90897 // fixed since gcc8.4
265 # if defined(__GNUC__) && (__GNUC__ == 8 && __GNUC_MINOR__ < 4)
266 # define SEQAN3_WORKAROUND_GCC_90897 1
267 # else
268 # define SEQAN3_WORKAROUND_GCC_90897 0
269 # endif
270 #endif
271 
273 #ifndef SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES
274 # if defined(__GNUC__) && ((__GNUC__ == 7) || (__GNUC__ == 8))
275 # define SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES 1
276 # else
277 # define SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES 0
278 # endif
279 #endif
280 
282 #ifndef SEQAN3_WORKAROUND_GCC_93467 // fixed since gcc10.2
283 # if defined(__GNUC__) && ((__GNUC__ <= 9) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2))
284 # define SEQAN3_WORKAROUND_GCC_93467 1
285 # else
286 # define SEQAN3_WORKAROUND_GCC_93467 0
287 # endif
288 #endif
289 
292 #ifndef SEQAN3_WORKAROUND_GCC_94967 // fixed since gcc8
293 # if defined(__GNUC__) && (__GNUC__ <= 7)
294 # define SEQAN3_WORKAROUND_GCC_94967 1
295 # else
296 # define SEQAN3_WORKAROUND_GCC_94967 0
297 # endif
298 #endif
299 
301 #ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
302 # if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
303 # define SEQAN3_WORKAROUND_GCC_96070 1
304 # else
305 # define SEQAN3_WORKAROUND_GCC_96070 0
306 # endif
307 #endif
308 
310 #ifndef SEQAN3_WORKAROUND_GCC_99318 // fixed since gcc10.3
311 # if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 3)
312 # define SEQAN3_WORKAROUND_GCC_99318 1
313 # else
314 # define SEQAN3_WORKAROUND_GCC_99318 0
315 # endif
316 #endif
317 
320 #ifndef SEQAN3_WORKAROUND_GCC_100139 // not yet fixed
321 # if defined(__GNUC__)
322 # define SEQAN3_WORKAROUND_GCC_100139 1
323 # else
324 # define SEQAN3_WORKAROUND_GCC_100139 0
325 # endif
326 #endif
327 
338 #ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
339 # if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
340 # define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
341 # else
342 # define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
343 # endif
344 #endif
345 
346 #if SEQAN3_DOXYGEN_ONLY(1)0
348 #define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
349 #endif // SEQAN3_DOXYGEN_ONLY(1)0
350 
351 #if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
352 # ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
353 # 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."
354 # endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
355 #endif // _GLIBCXX_USE_CXX11_ABI == 0
356 
360 #ifndef SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES
361 # if defined(__GNUC_MINOR__) && (__GNUC__ < 10) // fixed since gcc-10
362 # define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 1
363 # else
364 # define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 0
365 # endif
366 #endif
367 
370 #ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
371 # if defined(__GNUC__) && (__GNUC__ < 11)
372 # define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
373 # else
374 # define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
375 # endif
376 #endif
377 
379 #ifndef SEQAN3_WORKAROUND_GCC_INCOMPLETE_FILESYSTEM
380 # if defined(__GNUC__) && (__GNUC__ == 7)
381 # define SEQAN3_WORKAROUND_GCC_INCOMPLETE_FILESYSTEM 1
382 # else
383 # define SEQAN3_WORKAROUND_GCC_INCOMPLETE_FILESYSTEM 0
384 # endif
385 #endif
386 
387 
388 // ============================================================================
389 // Backmatter
390 // ============================================================================
391 
392 // macro cruft undefine
393 #undef SEQAN3_STR
394 #undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.