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// Compiler support
27// ============================================================================
28
29#if defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)
30# error "SeqAn 3.1.x is the last version that supports GCC 7 and 8. Please upgrade your compiler or use 3.1.x."
31#endif // defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)
32
33// ============================================================================
34// C++ standard and features
35// ============================================================================
36
37// C++ standard [required]
38#ifdef __cplusplus
39 static_assert(__cplusplus >= 201703, "SeqAn3 requires C++17, make sure that you have set -std=c++17.");
40#else
41# error "This is not a C++ compiler."
42#endif
43
44#if __has_include(<version>)
45# include <version>
46#endif
47
48// C++ Concepts [required]
49#ifndef __cpp_concepts
50# error "SeqAn3 requires C++ Concepts, either via the TS (flag: -fconcepts) or via C++20 (flag: -std=c++2a / -std=c++20)."
51#endif
52
54#if defined(__GNUC__) && (__GNUC__ < 10)
55# define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name, ...) \
56 {expression}; requires concept_name<decltype(expression), __VA_ARGS__>
57#else
58# define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name, ...) \
59 {expression} -> concept_name<__VA_ARGS__>
60#endif
61
62// filesystem [required]
63#if !__has_include(<filesystem>)
64# if !__has_include(<experimental/filesystem>)
65# error SeqAn3 requires C++17 filesystem support, but it was not found.
66# endif
67#endif
68
69// ============================================================================
70// Dependencies
71// ============================================================================
72
73// SeqAn [required]
74#if __has_include(<seqan3/version.hpp>)
75# include <seqan3/version.hpp>
76#else
77# error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
78#endif
79
80// Ranges [required]
81#if __has_include(<range/v3/version.hpp>)
82# define RANGE_V3_MINVERSION 1100
83# define RANGE_V3_MAXVERSION 1199
84// TODO the following doesn't actually show the current version, only its formula. How'd you do it?
85# define SEQAN3_MSG "Your version: " SEQAN3_STR(RANGE_V3_VERSION) \
86 "; minimum version: " SEQAN3_STR(RANGE_V3_MINVERSION) \
87 "; expected maximum version: " SEQAN3_STR(RANGE_V3_MAXVERSION)
88# include <range/v3/version.hpp>
89# if RANGE_V3_VERSION < RANGE_V3_MINVERSION
90# error Your range-v3 library is too old.
91# pragma message(SEQAN3_MSG)
92# elif RANGE_V3_VERSION > RANGE_V3_MAXVERSION
93# pragma GCC warning "Your range-v3 library is possibly too new. Some features might not work correctly."
94# pragma message(SEQAN3_MSG)
95# endif
96# undef SEQAN3_MSG
97#else
98# error The range-v3 library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
99#endif
100
101// SDSL [required]
102#if __has_include(<sdsl/version.hpp>)
103# include <sdsl/version.hpp>
104 static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
105#else
106# error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
107#endif
108
109// Cereal [optional]
114#ifndef SEQAN3_WITH_CEREAL
115# if __has_include(<cereal/cereal.hpp>)
116# define SEQAN3_WITH_CEREAL 1
117# else
118# define SEQAN3_WITH_CEREAL 0
119# endif
120#elif SEQAN3_WITH_CEREAL != 0
121# if ! __has_include(<cereal/cereal.hpp>)
122# error Cereal was marked as required, but not found!
123# endif
124#endif
125
126#if !SEQAN3_WITH_CEREAL
135# define CEREAL_SERIALIZE_FUNCTION_NAME serialize
137# define CEREAL_LOAD_FUNCTION_NAME load
139# define CEREAL_SAVE_FUNCTION_NAME save
141# define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
143# define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
147#endif
148
149// Lemon [optional]
154#ifndef SEQAN3_WITH_LEMON
155# if __has_include(<lemon/config.h>)
156# define SEQAN3_WITH_LEMON 1
157# else
158# define SEQAN3_WITH_LEMON 0
159# endif
160#elif SEQAN3_WITH_LEMON != 0
161# if !__has_include(<lemon/config.h>)
162# error Lemon was marked as required, but not found!
163# endif
164#endif
165#if SEQAN3_WITH_LEMON == 1
166# define LEMON_HAVE_LONG_LONG 1
167# define LEMON_CXX11 1
168# if defined(__unix__) || defined(__APPLE__)
169# define LEMON_USE_PTHREAD 1
170# define LEMON_USE_WIN32_THREADS 0
171# define LEMON_WIN32 0
172# else
173# define LEMON_USE_PTHREAD 0
174# define LEMON_USE_WIN32_THREADS 1
175# define LEMON_WIN32 1
176# endif
177#endif
178
179// TODO (doesn't have a version.hpp, yet)
180
181// ============================================================================
182// Documentation
183// ============================================================================
184
185// Doxygen related
186// this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
187#ifndef SEQAN3_DOXYGEN_ONLY
188# define SEQAN3_DOXYGEN_ONLY(x)
189#endif
190
191// ============================================================================
192// Deprecation Messages
193// ============================================================================
194
196#ifndef SEQAN3_PRAGMA
197# define SEQAN3_PRAGMA(non_string_literal) _Pragma(#non_string_literal)
198#endif
199
201#ifndef SEQAN3_DEPRECATED_HEADER
202# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
203# define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
204# else
205# define SEQAN3_DEPRECATED_HEADER(message)
206# endif
207#endif
208
209// ============================================================================
210// Workarounds
211// ============================================================================
212
219#if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
220# 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."
221#endif // defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
222
223#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
225# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
226#endif
227
229#ifndef SEQAN3_WORKAROUND_ISSUE_286
230# if defined(__GNUC__) && (__GNUC__ <= 9)
231# define SEQAN3_WORKAROUND_ISSUE_286 1
232# else
233# define SEQAN3_WORKAROUND_ISSUE_286 0
234# endif
235#endif
236
238#ifndef SEQAN3_WORKAROUND_GCC_89953
239# if defined(__GNUC_MINOR__) && (__GNUC__ == 9 && __GNUC_MINOR__ < 3)
240# define SEQAN3_WORKAROUND_GCC_89953 1
241# else
242# define SEQAN3_WORKAROUND_GCC_89953 0
243# endif
244#endif
245
247#ifndef SEQAN3_WORKAROUND_GCC_93467 // fixed since gcc10.2
248# if defined(__GNUC__) && ((__GNUC__ <= 9) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2))
249# define SEQAN3_WORKAROUND_GCC_93467 1
250# else
251# define SEQAN3_WORKAROUND_GCC_93467 0
252# endif
253#endif
254
256#ifndef SEQAN3_WORKAROUND_GCC_96070 // fixed since gcc10.4
257# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 4)
258# define SEQAN3_WORKAROUND_GCC_96070 1
259# else
260# define SEQAN3_WORKAROUND_GCC_96070 0
261# endif
262#endif
263
265#ifndef SEQAN3_WORKAROUND_GCC_99318 // fixed since gcc10.3
266# if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 3)
267# define SEQAN3_WORKAROUND_GCC_99318 1
268# else
269# define SEQAN3_WORKAROUND_GCC_99318 0
270# endif
271#endif
272
275#ifndef SEQAN3_WORKAROUND_GCC_100139 // not yet fixed
276# if defined(__GNUC__)
277# define SEQAN3_WORKAROUND_GCC_100139 1
278# else
279# define SEQAN3_WORKAROUND_GCC_100139 0
280# endif
281#endif
282
293#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
294# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
295# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
296# else
297# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
298# endif
299#endif
300
301#if SEQAN3_DOXYGEN_ONLY(1)0
303#define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
304#endif // SEQAN3_DOXYGEN_ONLY(1)0
305
306#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
307# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
308# 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."
309# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
310#endif // _GLIBCXX_USE_CXX11_ABI == 0
311
315#ifndef SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES
316# if defined(__GNUC_MINOR__) && (__GNUC__ < 10) // fixed since gcc-10
317# define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 1
318# else
319# define SEQAN3_WORKAROUND_GCC_NON_TEMPLATE_REQUIRES 0
320# endif
321#endif
322
325#ifndef SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT
326# if defined(__GNUC__) && (__GNUC__ < 11)
327# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 1
328# else
329# define SEQAN3_WORKAROUND_GCC_PIPEABLE_CONFIG_CONCEPT 0
330# endif
331#endif
332
352#ifndef SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION
353# if defined(__clang__)
354# define SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION 1
355# else
356# define SEQAN3_WORKAROUND_FURTHER_CONSTRAIN_FRIEND_DECLARATION 0
357# endif
358#endif
359
360// ============================================================================
361// Backmatter
362// ============================================================================
363
364// macro cruft undefine
365#undef SEQAN3_STR
366#undef SEQAN3_STR_HELPER
Provides SeqAn version macros and global variables.