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__ < 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// Ranges [required]
85#if __has_include(<range/v3/version.hpp>)
86# define RANGE_V3_MINVERSION 1100
87# define RANGE_V3_MAXVERSION 1199
88// TODO the following doesn't actually show the current version, only its formula. How'd you do it?
89# define SEQAN3_MSG \
90 "Your version: " SEQAN3_STR(RANGE_V3_VERSION) "; minimum version: " SEQAN3_STR( \
91 RANGE_V3_MINVERSION) "; expected maximum version: " SEQAN3_STR(RANGE_V3_MAXVERSION)
92# include <range/v3/version.hpp>
93# if RANGE_V3_VERSION < RANGE_V3_MINVERSION
94# error Your range-v3 library is too old.
95# pragma message(SEQAN3_MSG)
96# elif RANGE_V3_VERSION > RANGE_V3_MAXVERSION
97# pragma GCC warning "Your range-v3 library is possibly too new. Some features might not work correctly."
98# pragma message(SEQAN3_MSG)
99# endif
100# undef SEQAN3_MSG
101#else
102# error The range-v3 library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
103#endif
104
105// SDSL [required]
106#if __has_include(<sdsl/version.hpp>)
107# include <sdsl/version.hpp>
108static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
109#else
110# error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
111#endif
112
113// Cereal [optional]
118#ifndef SEQAN3_WITH_CEREAL
119# if __has_include(<cereal/cereal.hpp>)
120# define SEQAN3_WITH_CEREAL 1
121# else
122# define SEQAN3_WITH_CEREAL 0
123# endif
124#elif SEQAN3_WITH_CEREAL != 0
125# if !__has_include(<cereal/cereal.hpp>)
126# error Cereal was marked as required, but not found!
127# endif
128#endif
129
131#if !SEQAN3_WITH_CEREAL
137# define CEREAL_SERIALIZE_FUNCTION_NAME serialize
138# define CEREAL_LOAD_FUNCTION_NAME load
139# define CEREAL_SAVE_FUNCTION_NAME save
140# define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
141# define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
143#endif
145
146// Lemon [optional]
151#ifndef SEQAN3_WITH_LEMON
152# if __has_include(<lemon/config.h>)
153# define SEQAN3_WITH_LEMON 1
154# else
155# define SEQAN3_WITH_LEMON 0
156# endif
157#elif SEQAN3_WITH_LEMON != 0
158# if !__has_include(<lemon/config.h>)
159# error Lemon was marked as required, but not found!
160# endif
161#endif
162#if SEQAN3_WITH_LEMON == 1
163# define LEMON_HAVE_LONG_LONG 1
164# define LEMON_CXX11 1
165# if defined(__unix__) || defined(__APPLE__)
166# define LEMON_USE_PTHREAD 1
167# define LEMON_USE_WIN32_THREADS 0
168# define LEMON_WIN32 0
169# else
170# define LEMON_USE_PTHREAD 0
171# define LEMON_USE_WIN32_THREADS 1
172# define LEMON_WIN32 1
173# endif
174#endif
175
176// TODO (doesn't have a version.hpp, yet)
177
178// ============================================================================
179// Deprecation Messages
180// ============================================================================
181
183#ifndef SEQAN3_PRAGMA
184# define SEQAN3_PRAGMA(non_string_literal) _Pragma(# non_string_literal)
185#endif
186
188#ifndef SEQAN3_DEPRECATED_HEADER
189# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
190# define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
191# else
192# define SEQAN3_DEPRECATED_HEADER(message)
193# endif
194#endif
195
197#ifndef SEQAN3_REMOVE_DEPRECATED_330
198# ifndef SEQAN3_DEPRECATED_330
199# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
200# define SEQAN3_DEPRECATED_330 \
201 [[deprecated("This will be removed in SeqAn-3.3.0; please see the documentation.")]]
202# else
203# define SEQAN3_DEPRECATED_330
204# endif
205# endif
206#endif
207
208// ============================================================================
209// Workarounds
210// ============================================================================
211
220#if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 2)
221# pragma GCC warning \
222 "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."
223#endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
224
225#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
227# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
228#endif
229
231#ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
232# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
233# define SEQAN3_WORKAROUND_GCC_96070 1
234# else
235# define SEQAN3_WORKAROUND_GCC_96070 0
236# endif
237#endif
238
241#ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
242# if defined(__GNUC__) && (__GNUC__ < 11)
243# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
244# else
245# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
246# endif
247#endif
248
250#ifndef SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW
251# if defined(__GNUC__) && (__GNUC__ < 12)
252# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 1
253# else
254# define SEQAN3_WORKAROUND_DEFAULT_CONSTRUCTIBLE_VIEW 0
255# endif
256#endif
257
260#ifndef SEQAN3_WORKAROUND_GCC_100139
261# if defined(__GNUC__) && (__GNUC__ < 12)
262# define SEQAN3_WORKAROUND_GCC_100139 1
263# else
264# define SEQAN3_WORKAROUND_GCC_100139 0
265# endif
266#endif
267
271#ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
272# if defined(__GNUC__) && (__GNUC__ == 12 && __GNUC_MINOR__ < 2)
273# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1
274# else
275# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 0
276# endif
277#endif
278
289#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
290# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
291# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
292# else
293# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
294# endif
295#endif
296
297#if SEQAN3_DOXYGEN_ONLY(1) 0
299# define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
300#endif // SEQAN3_DOXYGEN_ONLY(1)0
301
302#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
303# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
304# pragma message \
305 "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."
306# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
307#endif // _GLIBCXX_USE_CXX11_ABI == 0
308
309// ============================================================================
310// Backmatter
311// ============================================================================
312
313// macro cruft undefine
314#undef SEQAN3_STR
315#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.