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)
40# error "SeqAn 3.1.x is the last version that supports GCC 7 and 8. 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#if SEQAN3_DOXYGEN_ONLY(1)0
49#define SEQAN3_DISABLE_CPP17_DIAGNOSTIC
50#endif // SEQAN3_DOXYGEN_ONLY(1)0
51
52// C++ standard [required]
53#ifdef __cplusplus
54# if (__cplusplus < 201703)
55# error "SeqAn3 requires C++20, make sure that you have set -std=c++2a (gcc9) or -std=c++20 (gcc10 and higher)."
56# elif not defined(SEQAN3_DISABLE_CPP17_DIAGNOSTIC) && (__cplusplus >= 201703) && (__cplusplus < 201709)
57# pragma GCC warning "SeqAn 3.1.x is the last version that supports C++17. Newer SeqAn versions, including this one, might not compile with -std=c++17. To disable this warning, use -std=c++2a (gcc9), -std=c++20 (gcc10 and higher), or -DSEQAN3_DISABLE_CPP17_DIAGNOSTIC."
58# endif
59#else
60# error "This is not a C++ compiler."
61#endif
62
63// C++ Concepts [required]
64#ifndef __cpp_concepts
65# error "SeqAn3 requires C++ Concepts, either via -fconcepts (gcc9), or -std=c++20 (gcc10 and higher)."
66#endif
67
68#if __has_include(<version>)
69# include <version>
70#endif
71
72// ============================================================================
73// Dependencies
74// ============================================================================
75
76// SeqAn [required]
77#if __has_include(<seqan3/version.hpp>)
78# include <seqan3/version.hpp>
79#else
80# error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
81#endif
82
83// Ranges [required]
84#if __has_include(<range/v3/version.hpp>)
85# define RANGE_V3_MINVERSION 1100
86# define RANGE_V3_MAXVERSION 1199
87// TODO the following doesn't actually show the current version, only its formula. How'd you do it?
88# define SEQAN3_MSG "Your version: " SEQAN3_STR(RANGE_V3_VERSION) \
89 "; minimum version: " SEQAN3_STR(RANGE_V3_MINVERSION) \
90 "; expected maximum version: " SEQAN3_STR(RANGE_V3_MAXVERSION)
91# include <range/v3/version.hpp>
92# if RANGE_V3_VERSION < RANGE_V3_MINVERSION
93# error Your range-v3 library is too old.
94# pragma message(SEQAN3_MSG)
95# elif RANGE_V3_VERSION > RANGE_V3_MAXVERSION
96# pragma GCC warning "Your range-v3 library is possibly too new. Some features might not work correctly."
97# pragma message(SEQAN3_MSG)
98# endif
99# undef SEQAN3_MSG
100#else
101# error The range-v3 library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
102#endif
103
104// SDSL [required]
105#if __has_include(<sdsl/version.hpp>)
106# include <sdsl/version.hpp>
107 static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
108#else
109# error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
110#endif
111
112// Cereal [optional]
117#ifndef SEQAN3_WITH_CEREAL
118# if __has_include(<cereal/cereal.hpp>)
119# define SEQAN3_WITH_CEREAL 1
120# else
121# define SEQAN3_WITH_CEREAL 0
122# endif
123#elif SEQAN3_WITH_CEREAL != 0
124# if ! __has_include(<cereal/cereal.hpp>)
125# error Cereal was marked as required, but not found!
126# endif
127#endif
128
129#if !SEQAN3_WITH_CEREAL
138# define CEREAL_SERIALIZE_FUNCTION_NAME serialize
140# define CEREAL_LOAD_FUNCTION_NAME load
142# define CEREAL_SAVE_FUNCTION_NAME save
144# define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
146# define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
150#endif
151
152// Lemon [optional]
157#ifndef SEQAN3_WITH_LEMON
158# if __has_include(<lemon/config.h>)
159# define SEQAN3_WITH_LEMON 1
160# else
161# define SEQAN3_WITH_LEMON 0
162# endif
163#elif SEQAN3_WITH_LEMON != 0
164# if !__has_include(<lemon/config.h>)
165# error Lemon was marked as required, but not found!
166# endif
167#endif
168#if SEQAN3_WITH_LEMON == 1
169# define LEMON_HAVE_LONG_LONG 1
170# define LEMON_CXX11 1
171# if defined(__unix__) || defined(__APPLE__)
172# define LEMON_USE_PTHREAD 1
173# define LEMON_USE_WIN32_THREADS 0
174# define LEMON_WIN32 0
175# else
176# define LEMON_USE_PTHREAD 0
177# define LEMON_USE_WIN32_THREADS 1
178# define LEMON_WIN32 1
179# endif
180#endif
181
182// TODO (doesn't have a version.hpp, yet)
183
184// ============================================================================
185// Deprecation Messages
186// ============================================================================
187
189#ifndef SEQAN3_PRAGMA
190# define SEQAN3_PRAGMA(non_string_literal) _Pragma(#non_string_literal)
191#endif
192
194#ifndef SEQAN3_DEPRECATED_HEADER
195# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
196# define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
197# else
198# define SEQAN3_DEPRECATED_HEADER(message)
199# endif
200#endif
201
202// ============================================================================
203// Workarounds
204// ============================================================================
205
212#if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
213# 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."
214#endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
215
216#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
218# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
219#endif
220
222#ifndef SEQAN3_WORKAROUND_GCC_93467 // fixed since gcc10.2
223# if defined(__GNUC__) && ((__GNUC__ <= 9) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2))
224# define SEQAN3_WORKAROUND_GCC_93467 1
225# else
226# define SEQAN3_WORKAROUND_GCC_93467 0
227# endif
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
240#ifndef SEQAN3_WORKAROUND_GCC_99318 // fixed since gcc10.3
241# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 3)
242# define SEQAN3_WORKAROUND_GCC_99318 1
243# else
244# define SEQAN3_WORKAROUND_GCC_99318 0
245# endif
246#endif
247
250#ifndef SEQAN3_WORKAROUND_GCC_100139 // not yet fixed
251# if defined(__GNUC__)
252# define SEQAN3_WORKAROUND_GCC_100139 1
253# else
254# define SEQAN3_WORKAROUND_GCC_100139 0
255# endif
256#endif
257
260#ifndef SEQAN3_WORKAROUND_GCC_100252 // not yet fixed
261# if defined(__GNUC__) && (__GNUC__ >= 12)
262# define SEQAN3_WORKAROUND_GCC_100252 1
263# else
264# define SEQAN3_WORKAROUND_GCC_100252 0
265# endif
266#endif
267
278#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
279# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
280# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
281# else
282# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
283# endif
284#endif
285
286#if SEQAN3_DOXYGEN_ONLY(1)0
288#define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
289#endif // SEQAN3_DOXYGEN_ONLY(1)0
290
291#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
292# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
293# 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."
294# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
295#endif // _GLIBCXX_USE_CXX11_ABI == 0
296
300#ifndef SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES
301# if defined(__GNUC_MINOR__) && (__GNUC__ < 10) // fixed since gcc-10
302# define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 1
303# else
304# define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 0
305# endif
306#endif
307
310#ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
311# if defined(__GNUC__) && (__GNUC__ < 11)
312# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
313# else
314# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
315# endif
316#endif
317
337#ifndef SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION
338# if defined(__clang__)
339# define SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION 1
340# else
341# define SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION 0
342# endif
343#endif
344
345// ============================================================================
346// Backmatter
347// ============================================================================
348
349// macro cruft undefine
350#undef SEQAN3_STR
351#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.