EnTT 3.13.1
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#if defined(__cpp_exceptions) && !defined(ENTT_NOEXCEPTION)
7# define ENTT_CONSTEXPR
8# define ENTT_THROW throw
9# define ENTT_TRY try
10# define ENTT_CATCH catch(...)
11#else
12# define ENTT_CONSTEXPR constexpr // use only with throwing functions (waiting for C++20)
13# define ENTT_THROW
14# define ENTT_TRY if(true)
15# define ENTT_CATCH if(false)
16#endif
17
18#ifdef ENTT_USE_ATOMIC
19# include <atomic>
20# define ENTT_MAYBE_ATOMIC(Type) std::atomic<Type>
21#else
22# define ENTT_MAYBE_ATOMIC(Type) Type
23#endif
24
25#ifndef ENTT_ID_TYPE
26# include <cstdint>
27# define ENTT_ID_TYPE std::uint32_t
28#else
29# include <cstdint> // provides coverage for types in the std namespace
30#endif
31
32#ifndef ENTT_SPARSE_PAGE
33# define ENTT_SPARSE_PAGE 4096
34#endif
35
36#ifndef ENTT_PACKED_PAGE
37# define ENTT_PACKED_PAGE 1024
38#endif
39
40#ifdef ENTT_DISABLE_ASSERT
41# undef ENTT_ASSERT
42# define ENTT_ASSERT(condition, msg) (void(0))
43#elif !defined ENTT_ASSERT
44# include <cassert>
45# define ENTT_ASSERT(condition, msg) assert(condition)
46#endif
47
48#ifdef ENTT_DISABLE_ASSERT
49# undef ENTT_ASSERT_CONSTEXPR
50# define ENTT_ASSERT_CONSTEXPR(condition, msg) (void(0))
51#elif !defined ENTT_ASSERT_CONSTEXPR
52# define ENTT_ASSERT_CONSTEXPR(condition, msg) ENTT_ASSERT(condition, msg)
53#endif
54
55#define ENTT_FAIL(msg) ENTT_ASSERT(false, msg);
56
57#ifdef ENTT_NO_ETO
58# define ENTT_ETO_TYPE(Type) void
59#else
60# define ENTT_ETO_TYPE(Type) Type
61#endif
62
63#ifdef ENTT_STANDARD_CPP
64# define ENTT_NONSTD false
65#else
66# define ENTT_NONSTD true
67# if defined __clang__ || defined __GNUC__
68# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
69# define ENTT_PRETTY_FUNCTION_PREFIX '='
70# define ENTT_PRETTY_FUNCTION_SUFFIX ']'
71# elif defined _MSC_VER
72# define ENTT_PRETTY_FUNCTION __FUNCSIG__
73# define ENTT_PRETTY_FUNCTION_PREFIX '<'
74# define ENTT_PRETTY_FUNCTION_SUFFIX '>'
75# endif
76#endif
77
78#if defined _MSC_VER
79# pragma detect_mismatch("entt.version", ENTT_VERSION)
80# pragma detect_mismatch("entt.noexcept", ENTT_XSTR(ENTT_TRY))
81# pragma detect_mismatch("entt.id", ENTT_XSTR(ENTT_ID_TYPE))
82# pragma detect_mismatch("entt.nonstd", ENTT_XSTR(ENTT_NONSTD))
83#endif
84
85#endif