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// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2023, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2023, 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__ < 11)
65# error \
66 "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."
67# endif // (__GNUC__ < 11)
68
69# if (__GNUC__ == 11 && __GNUC_MINOR__ <= 3)
70# pragma GCC warning "Be aware that GCC < 11.4 might have bugs that cause SeqAn3 fail to compile."
71# endif // (__GNUC__ == 11 && __GNUC_MINOR__ <= 2)
72
73# if (__GNUC__ == 12 && __GNUC_MINOR__ <= 2)
74# pragma GCC warning "Be aware that GCC < 12.3 might have bugs that cause SeqAn3 fail to compile."
75# endif // (__GNUC__ == 12 && __GNUC_MINOR__ <= 1)
76
77# if SEQAN3_DOXYGEN_ONLY(1) 0
79# define SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
80# endif // SEQAN3_DOXYGEN_ONLY(1)0
81
82# ifndef SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
83# if (__GNUC__ > 14)
84# pragma message \
85 "Your compiler is newer than the latest supported compiler of this SeqAn version (gcc-14). It might be that SeqAn does not compile due to this. You can disable this warning by setting -DSEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC."
86# endif // (__GNUC__ > 14)
87# endif // SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC
88
89// ============================================================================
90// Compiler support Clang
91// ============================================================================
92
93#elif defined(__clang__)
94# if __clang_major__ < 17
95# error "Only Clang >= 17 is supported."
96# endif
97
98// ============================================================================
99// Compiler support other
100// ============================================================================
101
102#elif !defined(SEQAN3_DISABLE_COMPILER_CHECK)
103# error "Your compiler is not supported. You can disable this error by setting -DSEQAN3_DISABLE_COMPILER_CHECK."
104#endif // SEQAN3_COMPILER_IS_GCC
105
106// ============================================================================
107// C++ standard and features
108// ============================================================================
109
110#if __has_include(<version>)
111# include <version>
112#endif
113
114// C++ standard [required]
115#ifdef __cplusplus
116# if (__cplusplus < 202002L)
117# error "SeqAn3 requires C++20, make sure that you have set -std=c++20."
118# endif
119#else
120# error "This is not a C++ compiler."
121#endif
122
123// ============================================================================
124// Dependencies
125// ============================================================================
126
127// SeqAn [required]
128#if __has_include(<seqan3/version.hpp>)
129# include <seqan3/version.hpp>
130#else
131# error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
132#endif
133
134// SDSL [required]
135#if __has_include(<sdsl/version.hpp>)
136# include <sdsl/version.hpp>
137static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
138#else
139# error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
140#endif
141
142// Cereal [optional]
147#ifndef SEQAN3_WITH_CEREAL
148# if __has_include(<cereal/cereal.hpp>)
149# define SEQAN3_WITH_CEREAL 1
150# else
151# define SEQAN3_WITH_CEREAL 0
152# endif
153#elif SEQAN3_WITH_CEREAL != 0
154# if !__has_include(<cereal/cereal.hpp>)
155# error Cereal was marked as required, but not found!
156# endif
157#endif
158
160#if !SEQAN3_WITH_CEREAL
166# define CEREAL_SERIALIZE_FUNCTION_NAME serialize
167# define CEREAL_LOAD_FUNCTION_NAME load
168# define CEREAL_SAVE_FUNCTION_NAME save
169# define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
170# define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
172#endif
174
175// ============================================================================
176// Deprecation Messages
177// ============================================================================
178
180#ifndef SEQAN3_PRAGMA
181# define SEQAN3_PRAGMA(non_string_literal) _Pragma(#non_string_literal)
182#endif
183
185#ifndef SEQAN3_DEPRECATED_HEADER
186# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
187# define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
188# else
189# define SEQAN3_DEPRECATED_HEADER(message)
190# endif
191#endif
192
194#ifndef SEQAN3_REMOVE_DEPRECATED_340
195# ifndef SEQAN3_DEPRECATED_340
196# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
197# define SEQAN3_DEPRECATED_340 \
198 [[deprecated("This will be removed in SeqAn-3.4.0; please see the documentation.")]]
199# else
200# define SEQAN3_DEPRECATED_340
201# endif
202# endif
203#endif
204
205// ============================================================================
206// Workarounds
207// ============================================================================
208
209#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
211# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
212#endif
213
215#ifndef SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW
216# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12)
217# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 1
218# else
219# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 0
220# endif
221#endif
222
225#ifndef SEQAN3_WORKAROUND_GCC_100139
226# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12)
227# define SEQAN3_WORKAROUND_GCC_100139 1
228# else
229# define SEQAN3_WORKAROUND_GCC_100139 0
230# endif
231#endif
232
236#ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
237# if SEQAN3_COMPILER_IS_GCC && (__GNUC__ == 12 || __GNUC__ == 13 || __GNUC__ == 14)
238# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1
239# else
240# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 0
241# endif
242#endif
243
254#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
255# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
256# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
257# else
258# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
259# endif
260#endif
261
269#if __cpp_lib_constexpr_vector >= 201907L && (defined(_LIBCPP_VERSION) || !defined(_GLIBCXX_DEBUG))
270# define SEQAN3_WORKAROUND_LITERAL constexpr
271#else
272# define SEQAN3_WORKAROUND_LITERAL inline
273#endif
274
275#if SEQAN3_DOXYGEN_ONLY(1) 0
277# define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
278#endif // SEQAN3_DOXYGEN_ONLY(1)0
279
280#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
281# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
282# pragma message \
283 "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."
284# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
285#endif // _GLIBCXX_USE_CXX11_ABI == 0
286
287// ============================================================================
288// Backmatter
289// ============================================================================
290
291// macro cruft undefine
292#undef SEQAN3_STR
293#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.