SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
platform.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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)
23 
25 // ============================================================================
26 // C++ standard and features
27 // ============================================================================
28 
29 // C++ standard [required]
30 #ifdef __cplusplus
31  static_assert(__cplusplus >= 201703, "SeqAn3 requires C++17, make sure that you have set -std=c++17.");
32 #else
33 # error "This is not a C++ compiler."
34 #endif
35 
36 #if __has_include(<version>)
37 # include <version>
38 #endif
39 
40 // C++ Concepts [required]
41 #ifdef __cpp_concepts
42 # if __cpp_concepts == 201507 // GCC and Concepts TS
43 # define SEQAN3_CONCEPT concept bool
44 # else
45  static_assert(__cpp_concepts >= 201507, "Your compiler supports Concepts, but the support is not recent enough.");
46 # define SEQAN3_CONCEPT concept
47 # endif
48 #else
49 # error "SeqAn3 requires C++ Concepts, either vie the TS (flag: -fconcepts) or via C++20 (flag: -std=c++2a / -std=c++20)."
50 #endif
51 
53 #if defined(__GNUC__) && (__GNUC__ < 10)
54 # define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name, ...) \
55  {expression}; requires concept_name<decltype(expression), __VA_ARGS__>
56 #else
57 # define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name, ...) \
58  {expression} -> concept_name<__VA_ARGS__>
59 #endif
60 
61 // filesystem [required]
62 #if !__has_include(<filesystem>)
63 # if !__has_include(<experimental/filesystem>)
64 # error SeqAn3 requires C++17 filesystem support, but it was not found.
65 # endif
66 #endif
67 
68 // ============================================================================
69 // Dependencies
70 // ============================================================================
71 
72 // SeqAn [required]
73 #if !__has_include(<seqan3/version.hpp>)
74 # error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
75 #endif
76 
77 // Ranges [required]
78 #if __has_include(<range/v3/version.hpp>)
79 # define RANGE_V3_MINVERSION 1100
80 # define RANGE_V3_MAXVERSION 1199
81 // TODO the following doesn't actually show the current version, only its formula. How'd you do it?
82 # define SEQAN3_MSG "Your version: " SEQAN3_STR(RANGE_V3_VERSION) \
83  "; minimum version: " SEQAN3_STR(RANGE_V3_MINVERSION) \
84  "; expected maximum version: " SEQAN3_STR(RANGE_V3_MAXVERSION)
85 # include <range/v3/version.hpp>
86 # if RANGE_V3_VERSION < RANGE_V3_MINVERSION
87 # error Your range-v3 library is too old.
88 # pragma message(SEQAN3_MSG)
89 # elif RANGE_V3_VERSION > RANGE_V3_MAXVERSION
90 # pragma GCC warning "Your range-v3 library is possibly too new. Some features might not work correctly."
91 # pragma message(SEQAN3_MSG)
92 # endif
93 # undef SEQAN3_MSG
94 #else
95 # error The range-v3 library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
96 #endif
97 
98 // SDSL [required]
99 #if __has_include(<sdsl/version.hpp>)
100 # include <sdsl/version.hpp>
101  static_assert(sdsl::sdsl_version_major == 3, "Only version 3 of the SDSL is supported by SeqAn3.");
102 #else
103 # error The sdsl library was not included correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
104 #endif
105 
106 // Cereal [optional]
111 #ifndef SEQAN3_WITH_CEREAL
112 # if __has_include(<cereal/cereal.hpp>)
113 # define SEQAN3_WITH_CEREAL 1
114 # else
115 # define SEQAN3_WITH_CEREAL 0
116 # endif
117 #elif SEQAN3_WITH_CEREAL != 0
118 # if ! __has_include(<cereal/cereal.hpp>)
119 # error Cereal was marked as required, but not found!
120 # endif
121 #endif
122 
123 #if !SEQAN3_WITH_CEREAL
124 
131 # define CEREAL_SERIALIZE_FUNCTION_NAME serialize
133 # define CEREAL_LOAD_FUNCTION_NAME load
135 # define CEREAL_SAVE_FUNCTION_NAME save
137 # define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
139 # define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
141 
144 #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 // Documentation
180 // ============================================================================
181 
182 // Doxygen related
183 // this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
184 #ifndef SEQAN3_DOXYGEN_ONLY
185 # define SEQAN3_DOXYGEN_ONLY(x)
186 #endif
187 
188 // ============================================================================
189 // Deprecation Messages
190 // ============================================================================
191 
193 #if !defined(SEQAN3_DEPRECATED_310)
194 # define SEQAN3_DEPRECATED_310 [[deprecated("This will be removed in SeqAn-3.1.0; please see the documentation.")]]
195 #endif
196 
197 // ============================================================================
198 // Workarounds
199 // ============================================================================
200 
201 #ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
202 # define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
204 #endif
205 
207 #ifndef SEQAN3_WORKAROUND_GCC_87113
208 # if defined(__GNUC_MINOR__) && ((__GNUC__ == 7) || ((__GNUC__ == 8) && (__GNUC_MINOR__ < 3)))
209 # define SEQAN3_WORKAROUND_GCC_87113 1
210 # else
211 # define SEQAN3_WORKAROUND_GCC_87113 0
212 # endif
213 #endif
214 
216 #ifndef SEQAN3_WORKAROUND_GCC_90897
217 # if defined(__GNUC__) && (__GNUC__ == 8)
218 # define SEQAN3_WORKAROUND_GCC_90897 1
219 # else
220 # define SEQAN3_WORKAROUND_GCC_90897 0
221 # endif
222 #endif
223 
225 #ifndef SEQAN3_WORKAROUND_GCC_93983
226 # if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ <= 1)
227 # define SEQAN3_WORKAROUND_GCC_93983 1
228 # else
229 # define SEQAN3_WORKAROUND_GCC_93983 0
230 # endif
231 #endif
232 
234 #ifndef SEQAN3_WORKAROUND_GCC_95371 // regressed in gcc10, fixed for gcc10.2
235 # if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 2)
236 # define SEQAN3_WORKAROUND_GCC_95371 1
237 # else
238 # define SEQAN3_WORKAROUND_GCC_95371 0
239 # endif
240 #endif
241 
243 #ifndef SEQAN3_WORKAROUND_GCC_95578 // regressed in gcc10, fixed for gcc10.2
244 # if defined(__GNUC__) && (__GNUC__ == 10 && __GNUC_MINOR__ < 2)
245 # define SEQAN3_WORKAROUND_GCC_95578 1
246 # else
247 # define SEQAN3_WORKAROUND_GCC_95578 0
248 # endif
249 #endif
250 
252 #ifndef SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES
253 # if defined(__GNUC__) && ((__GNUC__ == 7) || (__GNUC__ == 8))
254 # define SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES 1
255 # else
256 # define SEQAN3_WORKAROUND_GCC7_AND_8_CONCEPT_ISSUES 0
257 # endif
258 #endif
259 
261 #ifndef SEQAN3_WORKAROUND_GCC_93467 // fixed since gcc10.2
262 # if defined(__GNUC__) && ((__GNUC__ <= 9) || (__GNUC__ == 10 && __GNUC_MINOR__ < 2))
263 # define SEQAN3_WORKAROUND_GCC_93467 1
264 # else
265 # define SEQAN3_WORKAROUND_GCC_93467 0
266 # endif
267 #endif
268 
270 #ifndef SEQAN3_WORKAROUND_GCC_96070 // not yet fixed, this is a defect within the standard lib
271 # if defined(__GNUC__)
272 # define SEQAN3_WORKAROUND_GCC_96070 1
273 # else
274 # define SEQAN3_WORKAROUND_GCC_96070 0
275 # endif
276 #endif
277 
278 // ============================================================================
279 // Backmatter
280 // ============================================================================
281 
282 // macro cruft undefine
283 #undef SEQAN3_STR
284 #undef SEQAN3_STR_HELPER
cinttypes
cstddef
ciso646
version