HIBF 1.0.0-rc.1
Loading...
Searching...
No Matches
platform.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2026, Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2026, Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12// IWYU pragma: always_keep
13// IWYU pragma: begin_exports
14
15#include <version> // for __cpp_lib_constexpr_vector
16
17// IWYU pragma: end_exports
18
19// ============================================================================
20// Documentation
21// ============================================================================
22
23// Doxygen related
24// this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
25#ifndef HIBF_DOXYGEN_ONLY
26# define HIBF_DOXYGEN_ONLY(x)
27#endif
28
29// ============================================================================
30// Compiler support general
31// ============================================================================
32
42#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER)
43# define HIBF_COMPILER_IS_GCC 1
44#else
45# define HIBF_COMPILER_IS_GCC 0
46#endif
47
52#ifndef HIBF_HAS_AVX512
53# if defined(__AVX512F__) && defined(__AVX512BW__)
54# define HIBF_HAS_AVX512 1
55# else
56# define HIBF_HAS_AVX512 0
57# endif
58#endif
59
60// ============================================================================
61// Compiler support
62// ============================================================================
63
64#if HIBF_COMPILER_IS_GCC && (__GNUC__ < 14)
65# error "At least GCC 14 is needed."
66#endif
67
68#if defined(__INTEL_LLVM_COMPILER) && (__INTEL_LLVM_COMPILER < 20250000)
69# error "At least Intel OneAPI 2025 is needed."
70#endif
71
72#if defined(__clang__) && defined(__clang_major__) && (__clang_major__ < 20) && !defined(__INTEL_LLVM_COMPILER)
73# error "At least Clang 20 is needed."
74#endif
75
76#if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0
77# pragma message "We do not actively support compiler that have -D_GLIBCXX_USE_CXX11_ABI=0 set."
78#endif // _GLIBCXX_USE_CXX11_ABI == 0
79
80// ============================================================================
81// Standard library support
82// ============================================================================
83
84#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 200000)
85# error "At least libc++ 20 is required."
86#endif
87
88#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 14)
89# error "At least libstdc++ 14 is needed."
90#endif
91
92// ============================================================================
93// C++ standard and features
94// ============================================================================
95
96// C++ standard [required]
97#ifdef __cplusplus
98# if (__cplusplus < 202302L)
99# error "C++23 is required, make sure that you have set -std=c++23."
100# endif
101#else
102# error "This is not a C++ compiler."
103#endif
104
105// ============================================================================
106// Dependencies
107// ============================================================================
108
109// HIBF [required]
110#if __has_include(<hibf/version.hpp>)
111# include <hibf/version.hpp>
112#else
113# error "HIBF include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?"
114#endif
Provides version macros and global variables.