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 "Your version: " SEQAN3_STR(RANGE_V3_VERSION) \
77 "; minimum version: " SEQAN3_STR(RANGE_V3_MINVERSION) \
78 "; 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>
95 static_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 [[deprecated("This will be removed in SeqAn-3.3.0; please see the documentation.")]]
195# else
196# define SEQAN3_DEPRECATED_330
197# endif
198# endif
199#endif
200
201// ============================================================================
202// Workarounds
203// ============================================================================
204
211#if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
212# pragma GCC warning "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."
213#endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
214
215#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
217# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
218#endif
219
221#ifndef SEQAN3_WORKAROUND_GCC_93467 // fixed since gcc10.2
222# if defined(__GNUC__) && ((__GNUC__ <= 9) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2))
223# define SEQAN3_WORKAROUND_GCC_93467 1
224# else
225# define SEQAN3_WORKAROUND_GCC_93467 0
226# endif
227#endif
228
230#ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
231# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
232# define SEQAN3_WORKAROUND_GCC_96070 1
233# else
234# define SEQAN3_WORKAROUND_GCC_96070 0
235# endif
236#endif
237
239#ifndef SEQAN3_WORKAROUND_GCC_99318 // fixed since gcc10.3
240# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 3)
241# define SEQAN3_WORKAROUND_GCC_99318 1
242# else
243# define SEQAN3_WORKAROUND_GCC_99318 0
244# endif
245#endif
246
249#ifndef SEQAN3_WORKAROUND_GCC_100139 // not yet fixed
250# if defined(__GNUC__)
251# define SEQAN3_WORKAROUND_GCC_100139 1
252# else
253# define SEQAN3_WORKAROUND_GCC_100139 0
254# endif
255#endif
256
259#ifndef SEQAN3_WORKAROUND_GCC_100252 // not yet fixed
260# if defined(__GNUC__) && (__GNUC__ >= 12)
261# define SEQAN3_WORKAROUND_GCC_100252 1
262# else
263# define SEQAN3_WORKAROUND_GCC_100252 0
264# endif
265#endif
266
277#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
278# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
279# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
280# else
281# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
282# endif
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 GCC warning "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."
293# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
294#endif // _GLIBCXX_USE_CXX11_ABI == 0
295
299#ifndef SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES
300# if defined(__GNUC_MINOR__) && (__GNUC__ < 10) // fixed since gcc-10
301# define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 1
302# else
303# define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 0
304# endif
305#endif
306
309#ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
310# if defined(__GNUC__) && (__GNUC__ < 11)
311# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
312# else
313# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
314# endif
315#endif
316
336#ifndef SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION
337# if defined(__clang__)
338# define SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION 1
339# else
340# define SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION 0
341# endif
342#endif
343
344// ============================================================================
345// Backmatter
346// ============================================================================
347
348// macro cruft undefine
349#undef SEQAN3_STR
350#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.