SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
platform.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <cinttypes>
13#include <ciso646> // makes _LIBCPP_VERSION available
14#include <cstddef> // makes __GLIBCXX__ available
15
16// macro cruft
18#define SEQAN3_STR_HELPER(x) #x
19#define SEQAN3_STR(x) SEQAN3_STR_HELPER(x)
21
22// ============================================================================
23// Documentation
24// ============================================================================
25
26// Doxygen related
27// this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
28#ifndef SEQAN3_DOXYGEN_ONLY
29# define SEQAN3_DOXYGEN_ONLY(x)
30#endif
31
32// ============================================================================
33// Compiler support general
34// ============================================================================
35
45#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER)
46# define SEQAN3_COMPILER_IS_GCC 1
47#else
48# define SEQAN3_COMPILER_IS_GCC 0
49#endif
50
51#if SEQAN3_DOXYGEN_ONLY(1) 0
53# define SEQAN3_DISABLE_COMPILER_CHECK
54#endif // SEQAN3_DOXYGEN_ONLY(1)0
55
56// ============================================================================
57// Compiler support GCC
58// ============================================================================
59
60#if SEQAN3_COMPILER_IS_GCC
61# if (__GNUC__ < 11)
62# error \
63 "SeqAn 3.1.x is the last version that supports GCC 7, 8, and 9. SeqAn 3.2.x is the latest version that support GCC 10. Please upgrade your compiler or use 3.1.x./3.2.x."
64# endif // (__GNUC__ < 11)
65
66# if (__GNUC__ == 11 && __GNUC_MINOR__ <= 3)
67# pragma GCC warning "Be aware that GCC < 11.4 might have bugs that cause SeqAn3 fail to compile."
68# endif // (__GNUC__ == 11 && __GNUC_MINOR__ <= 2)
69
70# if (__GNUC__ == 12 && __GNUC_MINOR__ <= 2)
71# pragma GCC warning "Be aware that GCC < 12.3 might have bugs that cause SeqAn3 fail to compile."
72# endif // (__GNUC__ == 12 && __GNUC_MINOR__ <= 1)
73
74# if SEQAN3_DOXYGEN_ONLY(1) 0
76# define SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
77# endif // SEQAN3_DOXYGEN_ONLY(1)0
78
79# ifndef SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
80# if (__GNUC__ > 13)
81# pragma message \
82 "Your compiler is newer than the latest supported compiler of this SeqAn version (gcc-13). It might be that SeqAn does not compile due to this. You can disable this warning by setting -DSEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC."
83# endif // (__GNUC__ > 13)
84# endif // SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
85
86// ============================================================================
87// Compiler support Clang
88// ============================================================================
89
90#elif defined(__clang__)
91# if __clang_major__ < 17
92# error "Only Clang >= 17 is supported."
93# endif
94
95// ============================================================================
96// Compiler support other
97// ============================================================================
98
99#elif !defined(SEQAN3_DISABLE_COMPILER_CHECK)
100# error "Your compiler is not supported. You can disable this error by setting -DSEQAN3_DISABLE_COMPILER_CHECK."
101#endif // SEQAN3_COMPILER_IS_GCC
102
103// ============================================================================
104// C++ standard and features
105// ============================================================================
106
107#if __has_include(<version>)
108# include <version>
109#endif
110
111// C++ standard [required]
112#ifdef __cplusplus
113# if (__cplusplus < 202002L)
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_DEFAULT_CONSTRUCTIBLE_VIEW
213# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12)
214# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 1
215# else
216# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 0
217# endif
218#endif
219
222#ifndef SEQAN3_WORKAROUND_GCC_100139
223# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12)
224# define SEQAN3_WORKAROUND_GCC_100139 1
225# else
226# define SEQAN3_WORKAROUND_GCC_100139 0
227# endif
228#endif
229
233#ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
234# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ == 12 || __GNUC__ == 13)
235# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1
236# else
237# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 0
238# endif
239#endif
240
251#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
252# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
253# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
254# else
255# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
256# endif
257#endif
258
266#if __cpp_lib_constexpr_vector >= 201907L && (defined(_LIBCPP_VERSION) || !defined(_GLIBCXX_DEBUG))
267# define SEQAN3_WORKAROUND_LITERAL constexpr
268#else
269# define SEQAN3_WORKAROUND_LITERAL inline
270#endif
271
272#if SEQAN3_DOXYGEN_ONLY(1) 0
274# define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
275#endif // SEQAN3_DOXYGEN_ONLY(1)0
276
277#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
278# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
279# pragma message \
280 "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/seqan3/main_user/about_api.html#platform_stability for more details). You can disable this warning by setting -DSEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC."
281# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
282#endif // _GLIBCXX_USE_CXX11_ABI == 0
283
284// ============================================================================
285// Backmatter
286// ============================================================================
287
288// macro cruft undefine
289#undef SEQAN3_STR
290#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.
Hide me