EnTT 3.15.0
Loading...
Searching...
No Matches
config.h
1#ifndef ENTT_CONFIG_CONFIG_H
2#define ENTT_CONFIG_CONFIG_H
3
4#include "version.h"
5
6// NOLINTBEGIN(cppcoreguidelines-macro-usage)
7
8#if defined(__cpp_exceptions) && !defined(ENTT_NOEXCEPTION)
9# define ENTT_CONSTEXPR
10# define ENTT_THROW throw
11# define ENTT_TRY try
12# define ENTT_CATCH catch(...)
13#else
14# define ENTT_CONSTEXPR constexpr // use only with throwing functions (waiting for C++20)
15# define ENTT_THROW
16# define ENTT_TRY if(true)
17# define ENTT_CATCH if(false)
18#endif
19
20#if __has_include(<version>)
21# include <version>
22#
23# if defined(__cpp_consteval)
24# define ENTT_CONSTEVAL consteval
25# endif
26#endif
27
28#ifndef ENTT_CONSTEVAL
29# define ENTT_CONSTEVAL constexpr
30#endif
31
32#ifdef ENTT_USE_ATOMIC
33# include <atomic>
34# define ENTT_MAYBE_ATOMIC(Type) std::atomic<Type>
35#else
36# define ENTT_MAYBE_ATOMIC(Type) Type
37#endif
38
39#ifndef ENTT_ID_TYPE
40# include <cstdint>
41# define ENTT_ID_TYPE std::uint32_t
42#else
43# include <cstdint> // provides coverage for types in the std namespace
44#endif
45
46#ifndef ENTT_SPARSE_PAGE
47# define ENTT_SPARSE_PAGE 4096
48#endif
49
50#ifndef ENTT_PACKED_PAGE
51# define ENTT_PACKED_PAGE 1024
52#endif
53
54#ifdef ENTT_DISABLE_ASSERT
55# undef ENTT_ASSERT
56# define ENTT_ASSERT(condition, msg) (void(0))
57#elif !defined ENTT_ASSERT
58# include <cassert>
59# define ENTT_ASSERT(condition, msg) assert(((condition) && (msg)))
60#endif
61
62#ifdef ENTT_DISABLE_ASSERT
63# undef ENTT_ASSERT_CONSTEXPR
64# define ENTT_ASSERT_CONSTEXPR(condition, msg) (void(0))
65#elif !defined ENTT_ASSERT_CONSTEXPR
66# define ENTT_ASSERT_CONSTEXPR(condition, msg) ENTT_ASSERT(condition, msg)
67#endif
68
69#define ENTT_FAIL(msg) ENTT_ASSERT(false, msg);
70
71#ifdef ENTT_NO_ETO
72# define ENTT_ETO_TYPE(Type) void
73#else
74# define ENTT_ETO_TYPE(Type) Type
75#endif
76
77#ifdef ENTT_NO_MIXIN
78# define ENTT_STORAGE(Mixin, ...) __VA_ARGS__
79#else
80# define ENTT_STORAGE(Mixin, ...) Mixin<__VA_ARGS__>
81#endif
82
83#ifdef ENTT_STANDARD_CPP
84# define ENTT_NONSTD false
85#else
86# define ENTT_NONSTD true
87# if defined __clang__ || defined __GNUC__
88# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
89# define ENTT_PRETTY_FUNCTION_PREFIX '='
90# define ENTT_PRETTY_FUNCTION_SUFFIX ']'
91# elif defined _MSC_VER
92# define ENTT_PRETTY_FUNCTION __FUNCSIG__
93# define ENTT_PRETTY_FUNCTION_PREFIX '<'
94# define ENTT_PRETTY_FUNCTION_SUFFIX '>'
95# endif
96#endif
97
98#if defined _MSC_VER
99# pragma detect_mismatch("entt.version", ENTT_VERSION)
100# pragma detect_mismatch("entt.noexcept", ENTT_XSTR(ENTT_TRY))
101# pragma detect_mismatch("entt.id", ENTT_XSTR(ENTT_ID_TYPE))
102# pragma detect_mismatch("entt.nonstd", ENTT_XSTR(ENTT_NONSTD))
103#endif
104
105// NOLINTEND(cppcoreguidelines-macro-usage)
106
107#endif