EnTT 4.0.0
Loading...
Searching...
No Matches
config.h
1#ifndef ENTT_CONFIG_CONFIG_H
2#define ENTT_CONFIG_CONFIG_H
3
4#if __has_include(<entt/ext/config.h>)
5# include <entt/ext/config.h>
6#endif
7
8#include <version>
9#include "version.h"
10
11// NOLINTBEGIN(cppcoreguidelines-macro-usage)
12
13#ifdef ENTT_USE_STL
14# define ENTT_FORCE_STL
15#endif
16
17#if defined(__cpp_exceptions) && !defined(ENTT_NO_EXCEPTION)
18# define ENTT_THROW throw
19# define ENTT_TRY try
20# define ENTT_CATCH catch(...)
21#else
22# define ENTT_THROW
23# define ENTT_TRY if(true)
24# define ENTT_CATCH if(false)
25#endif
26
27#if defined(__cpp_consteval)
28# define ENTT_CONSTEVAL consteval
29#else
30# define ENTT_CONSTEVAL constexpr
31#endif
32
33#ifdef ENTT_USE_ATOMIC
34# include "../stl/atomic.hpp"
35# define ENTT_MAYBE_ATOMIC(Type) stl::atomic<Type>
36#else
37# define ENTT_MAYBE_ATOMIC(Type) Type
38#endif
39
40#ifndef ENTT_ID_TYPE
41# include "../stl/cstdint.hpp"
42# define ENTT_ID_TYPE stl::uint32_t
43#else
44# include "../stl/cstdint.hpp" // provides coverage for types in the std namespace
45#endif
46
47#ifndef ENTT_SPARSE_PAGE
48# define ENTT_SPARSE_PAGE 4096
49#endif
50
51#ifndef ENTT_PACKED_PAGE
52# define ENTT_PACKED_PAGE 1024
53#endif
54
55#ifdef ENTT_DISABLE_ASSERT
56# undef ENTT_ASSERT
57# define ENTT_ASSERT(condition, msg) (void(0))
58#elif !defined ENTT_ASSERT
59# include <cassert>
60# define ENTT_ASSERT(condition, msg) assert(((condition) && (msg)))
61#endif
62
63#ifdef ENTT_DISABLE_ASSERT
64# undef ENTT_ASSERT_CONSTEXPR
65# define ENTT_ASSERT_CONSTEXPR(condition, msg) (void(0))
66#elif !defined ENTT_ASSERT_CONSTEXPR
67# define ENTT_ASSERT_CONSTEXPR(condition, msg) ENTT_ASSERT(condition, msg)
68#endif
69
70#define ENTT_FAIL(msg) ENTT_ASSERT(false, msg);
71
72#ifdef ENTT_NO_ETO
73# define ENTT_ETO_TYPE(Type) void
74#else
75# define ENTT_ETO_TYPE(Type) Type
76#endif
77
78#ifdef ENTT_NO_MIXIN
79# define ENTT_STORAGE(Mixin, ...) __VA_ARGS__
80#else
81# define ENTT_STORAGE(Mixin, ...) Mixin<__VA_ARGS__>
82#endif
83
84#ifdef ENTT_STANDARD_CPP
85# define ENTT_NONSTD false
86#else
87# define ENTT_NONSTD true
88# if defined __clang__ || defined __GNUC__
89# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
90# define ENTT_PRETTY_FUNCTION_PREFIX '='
91# define ENTT_PRETTY_FUNCTION_SUFFIX ']'
92# elif defined _MSC_VER
93# define ENTT_PRETTY_FUNCTION __FUNCSIG__
94# define ENTT_PRETTY_FUNCTION_PREFIX '<'
95# define ENTT_PRETTY_FUNCTION_SUFFIX '>'
96# endif
97#endif
98
99#ifndef ENTT_EXPORT
100# if defined _WIN32 || defined __CYGWIN__ || defined _MSC_VER
101# define ENTT_EXPORT __declspec(dllexport)
102# define ENTT_IMPORT __declspec(dllimport)
103# define ENTT_HIDDEN
104# elif defined __GNUC__ && __GNUC__ >= 4
105# define ENTT_EXPORT __attribute__((visibility("default")))
106# define ENTT_IMPORT __attribute__((visibility("default")))
107# define ENTT_HIDDEN __attribute__((visibility("hidden")))
108# else /* Unsupported compiler */
109# define ENTT_EXPORT
110# define ENTT_IMPORT
111# define ENTT_HIDDEN
112# endif
113#endif
114
115#ifndef ENTT_API
116# if defined ENTT_API_EXPORT
117# define ENTT_API ENTT_EXPORT
118# elif defined ENTT_API_IMPORT
119# define ENTT_API ENTT_IMPORT
120# else /* No API */
121# define ENTT_API
122# endif
123#endif
124
125#if defined _MSC_VER
126# pragma detect_mismatch("entt.version", ENTT_VERSION)
127# pragma detect_mismatch("entt.noexcept", ENTT_XSTR(ENTT_TRY))
128# pragma detect_mismatch("entt.id", ENTT_XSTR(ENTT_ID_TYPE))
129# pragma detect_mismatch("entt.nonstd", ENTT_XSTR(ENTT_NONSTD))
130#endif
131
132// NOLINTEND(cppcoreguidelines-macro-usage)
133
134#endif