SeqAn3 3.2.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// Documentation
27// ============================================================================
28
29// Doxygen related
30// this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
31#ifndef SEQAN3_DOXYGEN_ONLY
32# define SEQAN3_DOXYGEN_ONLY(x)
33#endif
34
35// ============================================================================
36// Compiler support
37// ============================================================================
38
39#if defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8 || __GNUC__ == 9)
40# error "SeqAn 3.1.x is the last version that supports GCC 7, 8, and 9. Please upgrade your compiler or use 3.1.x."
41#endif // defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)
42
43// ============================================================================
44// C++ standard and features
45// ============================================================================
46
47// C++ standard [required]
48#ifdef __cplusplus
49# if (__cplusplus < 201709)
50# error "SeqAn3 requires C++20, make sure that you have set -std=c++20."
51# endif
52#else
53# error "This is not a C++ compiler."
54#endif
55
56#if __has_include(<version>)
57# include <version>
58#endif
59
60// ============================================================================
61// Dependencies
62// ============================================================================
63
64// SeqAn [required]
65#if __has_include(<seqan3/version.hpp>)
66# include <seqan3/version.hpp>
67#else
68# error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
69#endif
70
71// Ranges [required]
72#if __has_include(<range/v3/version.hpp>)
73# define RANGE_V3_MINVERSION 1100
74# define RANGE_V3_MAXVERSION 1199
75// TODO the following doesn't actually show the current version, only its formula. How'd you do it?
76# define SEQAN3_MSG \
77 "Your version: " SEQAN3_STR(RANGE_V3_VERSION) "; minimum version: " SEQAN3_STR( \
78 RANGE_V3_MINVERSION) "; expected maximum version: " SEQAN3_STR(RANGE_V3_MAXVERSION)
79# include <range/v3/version.hpp>
80# if RANGE_V3_VERSION < RANGE_V3_MINVERSION
81# error Your range-v3 library is too old.
82# pragma message(SEQAN3_MSG)
83# elif RANGE_V3_VERSION > RANGE_V3_MAXVERSION
84# pragma GCC warning "Your range-v3 library is possibly too new. Some features might not work correctly."
85# pragma message(SEQAN3_MSG)
86# endif
87# undef SEQAN3_MSG
88#else
89# error The range-v3 library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
90#endif
91
92// SDSL [required]
93#if __has_include(<sdsl/version.hpp>)
94# include <sdsl/version.hpp>
95static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
96#else
97# error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
98#endif
99
100// Cereal [optional]
105#ifndef SEQAN3_WITH_CEREAL
106# if __has_include(<cereal/cereal.hpp>)
107# define SEQAN3_WITH_CEREAL 1
108# else
109# define SEQAN3_WITH_CEREAL 0
110# endif
111#elif SEQAN3_WITH_CEREAL != 0
112# if !__has_include(<cereal/cereal.hpp>)
113# error Cereal was marked as required, but not found!
114# endif
115#endif
116
117#if !SEQAN3_WITH_CEREAL
126# define CEREAL_SERIALIZE_FUNCTION_NAME serialize
128# define CEREAL_LOAD_FUNCTION_NAME load
130# define CEREAL_SAVE_FUNCTION_NAME save
132# define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
134# define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
138#endif
139
140// Lemon [optional]
145#ifndef SEQAN3_WITH_LEMON
146# if __has_include(<lemon/config.h>)
147# define SEQAN3_WITH_LEMON 1
148# else
149# define SEQAN3_WITH_LEMON 0
150# endif
151#elif SEQAN3_WITH_LEMON != 0
152# if !__has_include(<lemon/config.h>)
153# error Lemon was marked as required, but not found!
154# endif
155#endif
156#if SEQAN3_WITH_LEMON == 1
157# define LEMON_HAVE_LONG_LONG 1
158# define LEMON_CXX11 1
159# if defined(__unix__) || defined(__APPLE__)
160# define LEMON_USE_PTHREAD 1
161# define LEMON_USE_WIN32_THREADS 0
162# define LEMON_WIN32 0
163# else
164# define LEMON_USE_PTHREAD 0
165# define LEMON_USE_WIN32_THREADS 1
166# define LEMON_WIN32 1
167# endif
168#endif
169
170// TODO (doesn't have a version.hpp, yet)
171
172// ============================================================================
173// Deprecation Messages
174// ============================================================================
175
177#ifndef SEQAN3_PRAGMA
178# define SEQAN3_PRAGMA(non_string_literal) _Pragma(# non_string_literal)
179#endif
180
182#ifndef SEQAN3_DEPRECATED_HEADER
183# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
184# define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
185# else
186# define SEQAN3_DEPRECATED_HEADER(message)
187# endif
188#endif
189
191#ifndef SEQAN3_REMOVE_DEPRECATED_330
192# ifndef SEQAN3_DEPRECATED_330
193# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
194# define SEQAN3_DEPRECATED_330 \
195 [[deprecated("This will be removed in SeqAn-3.3.0; please see the documentation.")]]
196# else
197# define SEQAN3_DEPRECATED_330
198# endif
199# endif
200#endif
201
202// ============================================================================
203// Workarounds
204// ============================================================================
205
212#if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
213# pragma GCC warning \
214 "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."
215#endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
216
217#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
219# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
220#endif
221
223#ifndef SEQAN3_WORKAROUND_GCC_93467 // fixed since gcc10.2
224# if defined(__GNUC__) && ((__GNUC__ <= 9) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2))
225# define SEQAN3_WORKAROUND_GCC_93467 1
226# else
227# define SEQAN3_WORKAROUND_GCC_93467 0
228# endif
229#endif
230
232#ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
233# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
234# define SEQAN3_WORKAROUND_GCC_96070 1
235# else
236# define SEQAN3_WORKAROUND_GCC_96070 0
237# endif
238#endif
239
241#ifndef SEQAN3_WORKAROUND_GCC_99318 // fixed since gcc10.3
242# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 3)
243# define SEQAN3_WORKAROUND_GCC_99318 1
244# else
245# define SEQAN3_WORKAROUND_GCC_99318 0
246# endif
247#endif
248
251#ifndef SEQAN3_WORKAROUND_GCC_100139 // not yet fixed
252# if defined(__GNUC__)
253# define SEQAN3_WORKAROUND_GCC_100139 1
254# else
255# define SEQAN3_WORKAROUND_GCC_100139 0
256# endif
257#endif
258
261#ifndef SEQAN3_WORKAROUND_GCC_100252 // not yet fixed
262# if defined(__GNUC__) && (__GNUC__ >= 12)
263# define SEQAN3_WORKAROUND_GCC_100252 1
264# else
265# define SEQAN3_WORKAROUND_GCC_100252 0
266# endif
267#endif
268
279#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
280# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
281# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
282# else
283# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
284# endif
285#endif
286
287#if SEQAN3_DOXYGEN_ONLY(1) 0
289# define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
290#endif // SEQAN3_DOXYGEN_ONLY(1)0
291
292#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
293# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
294# pragma GCC warning \
295 "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."
296# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
297#endif // _GLIBCXX_USE_CXX11_ABI == 0
298
302#ifndef SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES
303# if defined(__GNUC_MINOR__) && (__GNUC__ < 10) // fixed since gcc-10
304# define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 1
305# else
306# define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 0
307# endif
308#endif
309
312#ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
313# if defined(__GNUC__) && (__GNUC__ < 11)
314# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
315# else
316# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
317# endif
318#endif
319
321#ifndef SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW
322# if defined(__GNUC__) && (__GNUC__ < 12)
323# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 1
324# else
325# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 0
326# endif
327#endif
328
332#ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
333# if defined(__GNUC__) && (__GNUC__ == 12 && __GNUC_MINOR__ < 2)
334# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1
335# else
336# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 0
337# endif
338#endif
339
359#ifndef SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION
360# if defined(__clang__)
361# define SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION 1
362# else
363# define SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION 0
364# endif
365#endif
366
367// ============================================================================
368// Backmatter
369// ============================================================================
370
371// macro cruft undefine
372#undef SEQAN3_STR
373#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.