SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
platform.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, 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
13#pragma once
14
15#include <cinttypes>
16#include <ciso646> // makes _LIBCPP_VERSION available
17#include <cstddef> // makes __GLIBCXX__ available
18
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__ < 10)
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__ < 10)
42
43#if SEQAN3_DOXYGEN_ONLY(1) 0
45# define SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
46#endif // SEQAN3_DOXYGEN_ONLY(1)0
47
48#ifndef SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
49# if defined(__GNUC__) && (__GNUC__ > 12)
50# pragma message \
51 "Your compiler is newer than the latest supported compiler of this SeqAn version (gcc-12). It might be that SeqAn does not compile due to this. You can disable this warning by setting -DSEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC."
52# endif // defined(__GNUC__) && (__GNUC__ > 12)
53#endif // SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
54
55// ============================================================================
56// C++ standard and features
57// ============================================================================
58
59// C++ standard [required]
60// Note: gcc10 -std=c++20 still defines __cplusplus=201709
61#ifdef __cplusplus
62# if (__cplusplus < 201709)
63# error "SeqAn3 requires C++20, make sure that you have set -std=c++20."
64# endif
65#else
66# error "This is not a C++ compiler."
67#endif
68
69#if __has_include(<version>)
70# include <version>
71#endif
72
73// ============================================================================
74// Dependencies
75// ============================================================================
76
77// SeqAn [required]
78#if __has_include(<seqan3/version.hpp>)
79# include <seqan3/version.hpp>
80#else
81# error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
82#endif
83
84// SDSL [required]
85#if __has_include(<sdsl/version.hpp>)
86# include <sdsl/version.hpp>
87static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
88#else
89# error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
90#endif
91
92// Cereal [optional]
97#ifndef SEQAN3_WITH_CEREAL
98# if __has_include(<cereal/cereal.hpp>)
99# define SEQAN3_WITH_CEREAL 1
100# else
101# define SEQAN3_WITH_CEREAL 0
102# endif
103#elif SEQAN3_WITH_CEREAL != 0
104# if !__has_include(<cereal/cereal.hpp>)
105# error Cereal was marked as required, but not found!
106# endif
107#endif
108
110#if !SEQAN3_WITH_CEREAL
116# define CEREAL_SERIALIZE_FUNCTION_NAME serialize
117# define CEREAL_LOAD_FUNCTION_NAME load
118# define CEREAL_SAVE_FUNCTION_NAME save
119# define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
120# define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
122#endif
124
125// ============================================================================
126// Deprecation Messages
127// ============================================================================
128
130#ifndef SEQAN3_PRAGMA
131# define SEQAN3_PRAGMA(non_string_literal) _Pragma(# non_string_literal)
132#endif
133
135#ifndef SEQAN3_DEPRECATED_HEADER
136# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
137# define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
138# else
139# define SEQAN3_DEPRECATED_HEADER(message)
140# endif
141#endif
142
144#ifndef SEQAN3_REMOVE_DEPRECATED_340
145# ifndef SEQAN3_DEPRECATED_340
146# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
147# define SEQAN3_DEPRECATED_340 \
148 [[deprecated("This will be removed in SeqAn-3.4.0; please see the documentation.")]]
149# else
150# define SEQAN3_DEPRECATED_340
151# endif
152# endif
153#endif
154
155// ============================================================================
156// Workarounds
157// ============================================================================
158
167#if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 2)
168# pragma GCC warning \
169 "Be aware that gcc 10.0, 10.1 and 10.2 are known to have several bugs that might make SeqAn3 fail to compile. Please use gcc >= 10.3."
170#endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
171
172#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
174# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
175#endif
176
178#ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
179# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
180# define SEQAN3_WORKAROUND_GCC_96070 1
181# else
182# define SEQAN3_WORKAROUND_GCC_96070 0
183# endif
184#endif
185
188#ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
189# if defined(__GNUC__) && (__GNUC__ < 11)
190# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
191# else
192# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
193# endif
194#endif
195
197#ifndef SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW
198# if defined(__GNUC__) && (__GNUC__ < 12)
199# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 1
200# else
201# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 0
202# endif
203#endif
204
207#ifndef SEQAN3_WORKAROUND_GCC_100139
208# if defined(__GNUC__) && (__GNUC__ < 12)
209# define SEQAN3_WORKAROUND_GCC_100139 1
210# else
211# define SEQAN3_WORKAROUND_GCC_100139 0
212# endif
213#endif
214
218#ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
219# if defined(__GNUC__) && (__GNUC__ == 12 && __GNUC_MINOR__ < 3)
220# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1
221# else
222# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 0
223# endif
224#endif
225
236#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
237# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
238# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
239# else
240# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
241# endif
242#endif
243
245#if defined(__cpp_lib_constexpr_vector) && __cpp_lib_constexpr_vector >= 201907L
246# define SEQAN3_WORKAROUND_LITERAL constexpr
247#else
248# define SEQAN3_WORKAROUND_LITERAL inline
249#endif
250
251#if SEQAN3_DOXYGEN_ONLY(1) 0
253# define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
254#endif // SEQAN3_DOXYGEN_ONLY(1)0
255
256#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
257# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
258# pragma message \
259 "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."
260# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
261#endif // _GLIBCXX_USE_CXX11_ABI == 0
262
263// ============================================================================
264// Backmatter
265// ============================================================================
266
267// macro cruft undefine
268#undef SEQAN3_STR
269#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.