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 general
37// ============================================================================
38
48#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER)
49# define SEQAN3_COMPILER_IS_GCC 1
50#else
51# define SEQAN3_COMPILER_IS_GCC 0
52#endif
53
54#if SEQAN3_DOXYGEN_ONLY(1) 0
56# define SEQAN3_DISABLE_COMPILER_CHECK
57#endif // SEQAN3_DOXYGEN_ONLY(1)0
58
59// ============================================================================
60// Compiler support GCC
61// ============================================================================
62
63#if SEQAN3_COMPILER_IS_GCC
64# if (__GNUC__ < 10)
65# error \
66 "SeqAn 3.1.x is the last version that supports GCC 7, 8, and 9. Please upgrade your compiler or use 3.1.x."
67# endif // (__GNUC__ < 10)
68
69# if (__GNUC__ == 10 && __GNUC_MINOR__ <= 3)
70# pragma GCC warning "Be aware that GCC < 10.4 might have bugs that cause SeqAn3 fail to compile."
71# endif // (__GNUC__ == 10 && __GNUC_MINOR__ <= 3)
72
73# if (__GNUC__ == 11 && __GNUC_MINOR__ <= 2)
74# pragma GCC warning "Be aware that GCC < 11.3 might have bugs that cause SeqAn3 fail to compile."
75# endif // (__GNUC__ == 11 && __GNUC_MINOR__ <= 2)
76
77# if (__GNUC__ == 12 && __GNUC_MINOR__ <= 1)
78# pragma GCC warning "Be aware that GCC < 12.2 might have bugs that cause SeqAn3 fail to compile."
79# endif // (__GNUC__ == 12 && __GNUC_MINOR__ <= 1)
80
81# if SEQAN3_DOXYGEN_ONLY(1) 0
83# define SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
84# endif // SEQAN3_DOXYGEN_ONLY(1)0
85
86# ifndef SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
87# if (__GNUC__ > 12)
88# pragma message \
89 "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."
90# endif // (__GNUC__ > 12)
91# endif // SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
92
93// ============================================================================
94// Compiler support other
95// ============================================================================
96
97#elif !defined(SEQAN3_DISABLE_COMPILER_CHECK)
98# error \
99 "Your compiler is not supported. Currently, only GCC is known to work. You can disable this error by setting -DSEQAN3_DISABLE_COMPILER_CHECK."
100#endif // SEQAN3_COMPILER_IS_GCC
101
102// ============================================================================
103// C++ standard and features
104// ============================================================================
105
106#if __has_include(<version>)
107# include <version>
108#endif
109
110// C++ standard [required]
111// Note: gcc10 -std=c++20 still defines __cplusplus=201709
112#ifdef __cplusplus
113# if (__cplusplus < 201709)
114# error "SeqAn3 requires C++20, make sure that you have set -std=c++20."
115# endif
116#else
117# error "This is not a C++ compiler."
118#endif
119
120// ============================================================================
121// Dependencies
122// ============================================================================
123
124// SeqAn [required]
125#if __has_include(<seqan3/version.hpp>)
126# include <seqan3/version.hpp>
127#else
128# error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
129#endif
130
131// SDSL [required]
132#if __has_include(<sdsl/version.hpp>)
133# include <sdsl/version.hpp>
134static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
135#else
136# error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
137#endif
138
139// Cereal [optional]
144#ifndef SEQAN3_WITH_CEREAL
145# if __has_include(<cereal/cereal.hpp>)
146# define SEQAN3_WITH_CEREAL 1
147# else
148# define SEQAN3_WITH_CEREAL 0
149# endif
150#elif SEQAN3_WITH_CEREAL != 0
151# if !__has_include(<cereal/cereal.hpp>)
152# error Cereal was marked as required, but not found!
153# endif
154#endif
155
157#if !SEQAN3_WITH_CEREAL
163# define CEREAL_SERIALIZE_FUNCTION_NAME serialize
164# define CEREAL_LOAD_FUNCTION_NAME load
165# define CEREAL_SAVE_FUNCTION_NAME save
166# define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
167# define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
169#endif
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_340
192# ifndef SEQAN3_DEPRECATED_340
193# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
194# define SEQAN3_DEPRECATED_340 \
195 [[deprecated("This will be removed in SeqAn-3.4.0; please see the documentation.")]]
196# else
197# define SEQAN3_DEPRECATED_340
198# endif
199# endif
200#endif
201
202// ============================================================================
203// Workarounds
204// ============================================================================
205
206#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
208# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
209#endif
210
212#ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
213# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
214# define SEQAN3_WORKAROUND_GCC_96070 1
215# else
216# define SEQAN3_WORKAROUND_GCC_96070 0
217# endif
218#endif
219
222#ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
223# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 11)
224# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
225# else
226# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
227# endif
228#endif
229
231#ifndef SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW
232# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12)
233# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 1
234# else
235# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 0
236# endif
237#endif
238
241#ifndef SEQAN3_WORKAROUND_GCC_100139
242# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12)
243# define SEQAN3_WORKAROUND_GCC_100139 1
244# else
245# define SEQAN3_WORKAROUND_GCC_100139 0
246# endif
247#endif
248
252#ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
253# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ == 12 && __GNUC_MINOR__ < 3)
254# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1
255# else
256# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 0
257# endif
258#endif
259
270#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
271# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
272# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
273# else
274# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
275# endif
276#endif
277
279#if defined(__cpp_lib_constexpr_vector) && __cpp_lib_constexpr_vector >= 201907L
280# define SEQAN3_WORKAROUND_LITERAL constexpr
281#else
282# define SEQAN3_WORKAROUND_LITERAL inline
283#endif
284
285#if SEQAN3_DOXYGEN_ONLY(1) 0
287# define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
288#endif // SEQAN3_DOXYGEN_ONLY(1)0
289
290#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
291# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
292# pragma message \
293 "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."
294# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
295#endif // _GLIBCXX_USE_CXX11_ABI == 0
296
297// ============================================================================
298// Backmatter
299// ============================================================================
300
301// macro cruft undefine
302#undef SEQAN3_STR
303#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.