sandbox
Loading...
Searching...
No Matches
target.hpp
1#ifndef LIBSBX_UTILITY_TARGET_HPP_
2#define LIBSBX_UTILITY_TARGET_HPP_
3
4#include <cstdint>
5#include <type_traits>
6
7namespace sbx::utility {
8
10enum class build_configuration : std::uint8_t {
11 debug = 0,
12 release = 1
13}; // enum class build_configuration
14
15#if defined(DEBUG) || !defined(NDEBUG)
16inline constexpr auto build_configuration_v = build_configuration::debug;
17#else
18inline constexpr auto build_configuration_v = build_configuration::release;
19#endif
20
22enum class operating_system : std::uint8_t {
23 windows = 0,
24 max = 1,
25 linux = 2,
26 unknown = 3
27}; // enum class operating_system
28
29#if defined(WIN32) || defined(_WIN32)
30inline constexpr auto operating_system_v = operating_system::windows;
31#elif defined(__APPLE__)
32inline constexpr auto operating_system_v = operating_system::mac;
33#elif defined(__linux__) || defined(__linux)
34inline constexpr auto operating_system_v = operating_system::linux;
35#else
36inline constexpr auto operating_system_v = operating_system::unknown;
37#endif
38
40enum class compiler : std::uint8_t {
41 clang = 0,
42 gnu = 1,
43 msc = 2,
44 unknown = 3
45}; // enum class compiler
46
47#if defined(__clang__)
48inline constexpr auto compiler_v = compiler::clang;
49#elif (defined(__GNUC__) || defined(__GNUG__) || defined(__MINGW32__))
50inline constexpr auto compiler_v = compiler::gnu;
51#elif defined(__MSC_VER)
52inline constexpr auto compiler_v = compiler::msc;
53#else
54inline constexpr auto compiler_v = compiler::unknown;
55#endif
56
57#if defined(SBX_CONSTEXPR_ENABLED)
58#define SBX_CONSTEXPR constexpr
59#else
60#define SBX_CONSTEXPR
61#endif
62
63} // namespace sbx::utility
64
65#endif // LIBSBX_UTILITY_TARGET_HPP_