Debian Codegraph @

src/mpt/base/detect_libcxx.hpp

raw
1 /* SPDX-License-Identifier: BSL-1.0 OR BSD-3-Clause */
2
3 #ifndef MPT_BASE_DETECT_LIBCXX_HPP
4 #define MPT_BASE_DETECT_LIBCXX_HPP
5
6
7
8 #include "mpt/base/detect_compiler.hpp"
9 #include "mpt/base/detect_os.hpp"
10
11 #if MPT_CXX_AT_LEAST(20)
12 #include <version>
13 #else // !C++20
14 #include <array>
15 #endif // C++20
16
17
18
19 // order of checks is important!
20 #if MPT_COMPILER_GENERIC
21 #define MPT_LIBCXX_GENERIC 1
22 #elif defined(_LIBCPP_VERSION)
23 #define MPT_LIBCXX_LLVM 1
24 #define MPT_LIBCXX_LLVM_VERSION _LIBCPP_VERSION
25 #define MPT_LIBCXX_LLVM_AT_LEAST(ver) (MPT_LIBCXX_LLVM_VERSION >= (ver))
26 #define MPT_LIBCXX_LLVM_BEFORE(ver) (MPT_LIBCXX_LLVM_VERSION < (ver))
27 #elif defined(__GLIBCXX__) || defined(__GLIBCPP__)
28 #define MPT_LIBCXX_GNU 1
29 #define MPT_LIBCXX_GNU_VERSION _GLIBCXX_RELEASE
30 #define MPT_LIBCXX_GNU_AT_LEAST(ver) (MPT_LIBCXX_GNU_VERSION >= (ver))
31 #define MPT_LIBCXX_GNU_BEFORE(ver) (MPT_LIBCXX_GNU_VERSION < (ver))
32 #elif MPT_COMPILER_MSVC
33 #define MPT_LIBCXX_MS 1
34 #elif MPT_COMPILER_CLANG && MPT_OS_WINDOWS
35 #define MPT_LIBCXX_MS 1
36 #else
37 #define MPT_LIBCXX_GENERIC 1
38 #endif
39
40 #ifndef MPT_LIBCXX_GENERIC
41 #define MPT_LIBCXX_GENERIC 0
42 #endif
43 #ifndef MPT_LIBCXX_LLVM
44 #define MPT_LIBCXX_LLVM 0
45 #define MPT_LIBCXX_LLVM_VERSION 0
46 #define MPT_LIBCXX_LLVM_AT_LEAST(ver) 0
47 #define MPT_LIBCXX_LLVM_BEFORE(ver) 0
48 #endif
49 #ifndef MPT_LIBCXX_GNU
50 #define MPT_LIBCXX_GNU 0
51 #define MPT_LIBCXX_GNU_VERSION 0
52 #define MPT_LIBCXX_GNU_AT_LEAST(ver) 0
53 #define MPT_LIBCXX_GNU_BEFORE(ver) 0
54 #endif
55 #ifndef MPT_LIBCXX_MS
56 #define MPT_LIBCXX_MS 0
57 #endif
58
59
60
61 #endif // MPT_BASE_DETECT_LIBCXX_HPP