Sharg 1.2.1-rc.1
The argument parser for bio-c++ tools.
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#include <version>
13
14// ============================================================================
15// Compiler support general
16// ============================================================================
17
26#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER)
27# define SHARG_COMPILER_IS_GCC 1
28#else
29# define SHARG_COMPILER_IS_GCC 0
30#endif
31
32// ============================================================================
33// Compiler support
34// ============================================================================
35
36#if SHARG_COMPILER_IS_GCC && (__GNUC__ < 12)
37# error "Sharg requires at least GCC 12."
38#endif
39
40// clang-format off
41#if defined(__INTEL_LLVM_COMPILER) && (__INTEL_LLVM_COMPILER < 20240000)
42# error "Sharg requires at least Intel OneAPI 2024."
43#endif
44// clang-format on
45
46#if defined(__clang__) && defined(__clang_major__) && (__clang_major__ < 17)
47# error "Sharg requires at least Clang 17."
48#endif
49
50// ============================================================================
51// Standard library support
52// ============================================================================
53
54#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 170000)
55# error "Sharg requires at least libc++ 17."
56#endif
57
58#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 12)
59# error "Sharg requires at least libstdc++ 12."
60#endif
61
62// ============================================================================
63// C++ standard and features
64// ============================================================================
65
66// C++ standard [required]
67#ifdef __cplusplus
68# if (__cplusplus < 202100)
69# error "Sharg requires C++23, make sure that you have set -std=c++23."
70# endif
71#else
72# error "This is not a C++ compiler."
73#endif
74
75// ============================================================================
76// Dependencies
77// ============================================================================
78
79// Sharg [required]
80#if __has_include(<sharg/version.hpp>)
81# include <sharg/version.hpp>
82#else
83# error "Sharg include directory not set correctly. Forgot to add -I ${INSTALLDIR}/include to your CXXFLAGS?"
84#endif
85
86// ============================================================================
87// Documentation
88// ============================================================================
89
90// Doxygen related
91// this macro is a NO-OP unless doxygen parses it, in which case it resolves to the argument
92#ifndef SHARG_DOXYGEN_ONLY
93# define SHARG_DOXYGEN_ONLY(x)
94#endif
Provides SHARG version macros and global variables.
Hide me