Loading...
Searching...
No Matches
platform.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <version>
// macro cruft
#define SEQAN3_STR_HELPER(x) #x
#define SEQAN3_STR(x) SEQAN3_STR_HELPER(x)
// ============================================================================
// Documentation
// ============================================================================
// Doxygen related
// this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
#ifndef SEQAN3_DOXYGEN_ONLY
# define SEQAN3_DOXYGEN_ONLY(x)
#endif
// ============================================================================
// Compiler support general
// ============================================================================
#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER)
# define SEQAN3_COMPILER_IS_GCC 1
#else
# define SEQAN3_COMPILER_IS_GCC 0
#endif
#if SEQAN3_DOXYGEN_ONLY(1) 0
# define SEQAN3_DISABLE_COMPILER_CHECK
#endif // SEQAN3_DOXYGEN_ONLY(1)0
// ============================================================================
// Compiler support
// ============================================================================
#if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12)
# error "At least GCC 12 is needed."
#endif
// clang-format off
#if defined(__INTEL_LLVM_COMPILER) && (__INTEL_LLVM_COMPILER < 20240000)
# error "At least Intel OneAPI 2024 is needed."
#endif
// clang-format on
#if defined(__clang__) && defined(__clang_major__) && (__clang_major__ < 17)
# error "At least Clang 17 is needed."
#endif
// ============================================================================
// Standard library support
// ============================================================================
#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 170000)
# error "At least libc++ 17 is required."
#endif
#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 12)
# error "At least libstdc++ 12 is needed."
#endif
// ============================================================================
// C++ standard and features
// ============================================================================
// C++ standard [required]
#ifdef __cplusplus
# if (__cplusplus < 202100)
# error "SeqAn3 requires C++23, make sure that you have set -std=c++23."
# endif
#else
# error "This is not a C++ compiler."
#endif
// ============================================================================
// Dependencies
// ============================================================================
// SeqAn [required]
#if __has_include(<seqan3/version.hpp>)
# include <seqan3/version.hpp>
#else
# error SeqAn3 include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?
#endif
// zlib [optional]
#ifndef SEQAN3_HAS_ZLIB
# if __has_include(<zlib.h>)
# define SEQAN3_HAS_ZLIB 1
# else
# define SEQAN3_HAS_ZLIB 0
# endif
#endif
// bzip2 [optional]
#ifndef SEQAN3_HAS_BZIP2
# if SEQAN3_HAS_ZLIB && __has_include(<bzlib.h>)
# define SEQAN3_HAS_BZIP2 1
# else
# define SEQAN3_HAS_BZIP2 0
# endif
#endif
// Cereal [optional]
#ifndef SEQAN3_HAS_CEREAL
# if __has_include(<cereal/cereal.hpp>)
# define SEQAN3_HAS_CEREAL 1
# else
# define SEQAN3_HAS_CEREAL 0
# endif
#endif
#if !SEQAN3_HAS_CEREAL
# define CEREAL_SERIALIZE_FUNCTION_NAME serialize
# define CEREAL_LOAD_FUNCTION_NAME load
# define CEREAL_SAVE_FUNCTION_NAME save
# define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
# define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
#endif
// ============================================================================
// Deprecation Messages
// ============================================================================
#ifndef SEQAN3_PRAGMA
# define SEQAN3_PRAGMA(non_string_literal) _Pragma(#non_string_literal)
#endif
#ifndef SEQAN3_DEPRECATED_HEADER
# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
# define SEQAN3_DEPRECATED_HEADER(message) SEQAN3_PRAGMA(GCC warning message)
# else
# define SEQAN3_DEPRECATED_HEADER(message) /**/
# endif
#endif
#ifndef SEQAN3_REMOVE_DEPRECATED_340
# ifndef SEQAN3_DEPRECATED_340
# ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
# define SEQAN3_DEPRECATED_340 \
[[deprecated("This will be removed in SeqAn-3.4.0; please see the documentation.")]]
# else
# define SEQAN3_DEPRECATED_340 /**/
# endif
# endif
#endif
// clang-format off
#if defined(SEQAN3_WITH_CEREAL) && defined(SEQAN3_HAS_CEREAL) && SEQAN3_WITH_CEREAL != SEQAN3_HAS_CEREAL
# error "SEQAN3_WITH_CEREAL is deprecated and has been replaced by SEQAN3_HAS_CEREAL. These two macros do not expand to the same value. Please use SEQAN3_HAS_CEREAL."
#endif
#ifndef SEQAN3_DISABLE_DEPRECATED_WARNINGS
# ifdef SEQAN3_WITH_CEREAL
# pragma GCC warning "SEQAN3_WITH_CEREAL is deprecated and will be removed in the next version; please use SEQAN3_HAS_CEREAL instead."
# else
# define SEQAN3_WITH_CEREAL \
SEQAN3_PRAGMA(GCC warning "SEQAN3_WITH_CEREAL is deprecated and will be removed in the next version; please use SEQAN3_HAS_CEREAL instead.") \
SEQAN3_HAS_CEREAL
# endif
#else
# ifndef SEQAN3_WITH_CEREAL
# define SEQAN3_WITH_CEREAL SEQAN3_HAS_CEREAL
# endif
#endif
// clang-format on
// ============================================================================
// Workarounds
// ============================================================================
#ifndef SEQAN3_WORKAROUND_VIEW_PERFORMANCE
# define SEQAN3_WORKAROUND_VIEW_PERFORMANCE 1
#endif
#ifndef SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
# if SEQAN3_COMPILER_IS_GCC
// For checking whether workaround applies, e.g., in search_scheme_test
# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 1
// The goal is to create _Pragma("GCC diagnostic ignored \"-Wrestrict\"")
// The outer quotes are added by SEQAN3_PRAGMA, so we need SEQAN3_PRAGMA(GCC diagnostic ignored "-Wrestrict")
// SEQAN3_CONCAT_STRING(GCC diagnostic ignored, -Wrestrict) -> SEQAN3_PRAGMA(GCC diagnostic ignored "-Wrestrict")
# define SEQAN3_CONCAT_STRING(x, y) SEQAN3_PRAGMA(x #y)
# define SEQAN3_GCC_DIAGNOSTIC_IGNORE1(x, ...) \
SEQAN3_PRAGMA(GCC diagnostic push) \
SEQAN3_CONCAT_STRING(GCC diagnostic ignored, x)
# define SEQAN3_GCC_DIAGNOSTIC_IGNORE2(x, y) \
SEQAN3_PRAGMA(GCC diagnostic push) \
SEQAN3_CONCAT_STRING(GCC diagnostic ignored, x) \
SEQAN3_CONCAT_STRING(GCC diagnostic ignored, y)
// A helper that enables SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START to take one or two arguments
// SEQAN3_GCC_DIAGNOSTIC_IGNORE(-Wrestict, 2, 1) -> SEQAN3_GCC_DIAGNOSTIC_IGNORE1(-Wrestict, 2)
// SEQAN3_GCC_DIAGNOSTIC_IGNORE(-Wrestict, -Warray-bounds, 2, 1) -> SEQAN3_GCC_DIAGNOSTIC_IGNORE2(-Wrestict, -Warray-bounds)
# define SEQAN3_GCC_DIAGNOSTIC_IGNORE(x, y, n, ...) SEQAN3_GCC_DIAGNOSTIC_IGNORE##n(x, y)
// SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(-Wrestrict) -> SEQAN3_GCC_DIAGNOSTIC_IGNORE(-Wrestict, 2, 1)
// SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(-Wrestrict, -Warray-bounds) -> SEQAN3_GCC_DIAGNOSTIC_IGNORE(-Wrestict, -Warray-bounds, 2, 1)
# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(x, ...) SEQAN3_GCC_DIAGNOSTIC_IGNORE(x, ##__VA_ARGS__, 2, 1)
# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_STOP SEQAN3_PRAGMA(GCC diagnostic pop)
# else
# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY 0
# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(...)
# define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_STOP
# endif
#endif
#ifndef SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 1
# else
# define SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI 0
# endif
#endif
#if __cpp_lib_constexpr_vector >= 201907L && (defined(_LIBCPP_VERSION) || !defined(_GLIBCXX_DEBUG))
# define SEQAN3_WORKAROUND_LITERAL constexpr
#else
# define SEQAN3_WORKAROUND_LITERAL inline
#endif
#if SEQAN3_DOXYGEN_ONLY(1) 0
# define SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
#endif // SEQAN3_DOXYGEN_ONLY(1)0
#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
# ifndef SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
# pragma message \
"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/seqan3/main_user/about_api.html#platform_stability for more details). You can disable this warning by setting -DSEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC."
# endif // SEQAN3_DISABLE_LEGACY_STD_DIAGNOSTIC
#endif // _GLIBCXX_USE_CXX11_ABI == 0
// ============================================================================
// Backmatter
// ============================================================================
// macro cruft undefine
#undef SEQAN3_STR
#undef SEQAN3_STR_HELPER
version.hpp
Provides SeqAn version macros and global variables.
Hide me