TGUI  0.9.5
Loading...
Searching...
No Matches
Config.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2022 Bruno Van de Velde (vdv_b@tgui.eu)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef TGUI_CONFIG_HPP
26#define TGUI_CONFIG_HPP
27
28// Config.hpp is generated by CMake, it should not be edited directly.
29
30// Detect the platform, to enable platform-specific code
31#if defined(_WIN32)
32 #define TGUI_SYSTEM_WINDOWS // Windows
33#elif defined(__APPLE__) && defined(__MACH__)
34 #include "TargetConditionals.h"
35 #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
36 #define TGUI_SYSTEM_IOS // iOS
37 #elif TARGET_OS_MAC
38 #define TGUI_SYSTEM_MACOS // macOS
39 #endif
40#elif defined(__unix__)
41 #if defined(__ANDROID__)
42 #define TGUI_SYSTEM_ANDROID // Android
43 #else //if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
44 #define TGUI_SYSTEM_LINUX // Linux or BSD
45 #endif
46#endif
47
48// TGUI will link in the same way as SFML, unless TGUI_DYNAMIC or TGUI_STATIC is defined
49#if !defined(TGUI_DYNAMIC) && !defined(TGUI_STATIC)
50 #ifdef SFML_STATIC
51 #define TGUI_STATIC
52 #endif
53#endif
54
55#ifndef TGUI_STATIC
56 #ifdef TGUI_SYSTEM_WINDOWS
57 // Windows compilers need specific (and different) keywords for export and import
58 #ifdef TGUI_EXPORTS
59 #define TGUI_API __declspec(dllexport)
60 #else
61 #define TGUI_API __declspec(dllimport)
62 #endif
63
64 // For Visual C++ compilers, we also need to turn off the annoying C4251 warning
65 #ifdef _MSC_VER
66 #pragma warning(disable: 4251)
67 #endif
68 #else
69 #define TGUI_API __attribute__ ((__visibility__ ("default")))
70 #endif
71#else
72 // Static build doesn't need import/export macros
73 #define TGUI_API
74#endif
75
76// Use OpenGL ES on mobile platforms (in backends that use OpenGL directly)
77#define TGUI_USE_GLES 0
78
79// Enables code that relies on a specific backend
80#define TGUI_HAS_BACKEND_SFML 1
81#define TGUI_HAS_BACKEND_SDL 0
82
83// Define that specifies the mininmum c++ support in both the TGUI code and user code.
84// This constant can be lower than the actual c++ standard version used to compile with,
85// as long as this constant is the same when compiling TGUI and when using the TGUI libs.
86#define TGUI_COMPILED_WITH_CPP_VER 17
87
88// Include the version header when c++20 is available to use the library feature-testing macros
89#if TGUI_COMPILED_WITH_CPP_VER >= 20
90 #include <version>
91#endif
92
93// Enable the use of std::filesystem if TGUI is built with c++17 with a new enough compiler.
94// Although GCC and clang supported it before version 9, this is the first version where no
95// additional library has to be linked in order to use std::filesystem. This is also the
96// reason why we can't rely on __cpp_lib_filesystem for this.
97#if TGUI_COMPILED_WITH_CPP_VER >= 17
98 #if defined(__clang_major__) && (__clang_major__ >= 9) \
99 || defined(__GNUC__) && (__GNUC__ >= 9) \
100 || defined(_MSC_VER) && (_MSC_VER >= 1914)
101 #define TGUI_USE_STD_FILESYSTEM
102 #endif
103#endif
104
105// No compiler supports clock_cast yet, so enabling the following define has never been tested
106//#if __cpp_lib_chrono >= 201907L && defined(TGUI_USE_STD_FILESYSTEM)
107// #define TGUI_USE_STD_FILESYSTEM_FILE_TIME
108//#endif
109
110#if defined(__cpp_constexpr) && (__cpp_constexpr >= 201304L)
111 #define TGUI_CONSTEXPR constexpr
112#else
113 #define TGUI_CONSTEXPR inline
114#endif
115
116#if __cplusplus >= 201703L
117 #define TGUI_EMPLACE_BACK(object, vector) auto& object = vector.emplace_back();
118#else
119 #define TGUI_EMPLACE_BACK(object, vector) vector.emplace_back(); auto& object = vector.back();
120#endif
121
122#ifndef TGUI_NO_DEPRECATED_WARNINGS
123 #define TGUI_DEPRECATED(msg) [[deprecated(msg)]]
124#else
125 #define TGUI_DEPRECATED(msg)
126#endif
127
128#if defined(__GNUC__)
129 #define TGUI_IGNORE_DEPRECATED_WARNINGS_START \
130 _Pragma("GCC diagnostic push") \
131 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
132
133 #define TGUI_IGNORE_DEPRECATED_WARNINGS_END _Pragma("GCC diagnostic pop")
134#elif defined (_MSC_VER) && (_MSC_VER >= 1927)
135 #define TGUI_IGNORE_DEPRECATED_WARNINGS_START \
136 _Pragma("warning(push)") \
137 _Pragma("warning(disable: 4996)")
138
139 #define TGUI_IGNORE_DEPRECATED_WARNINGS_END _Pragma("warning(pop)")
140#elif defined (_MSC_VER)
141 #define TGUI_IGNORE_DEPRECATED_WARNINGS_START \
142 __pragma(warning(push)) \
143 __pragma(warning(disable: 4996))
144
145 #define TGUI_IGNORE_DEPRECATED_WARNINGS_END __pragma(warning(pop))
146#endif
147
148#if !defined(NDEBUG) && !defined(TGUI_NO_RUNTIME_WARNINGS)
149 #include <iostream>
150 #define TGUI_PRINT_WARNING(msg) { std::cerr << "TGUI warning: " << msg << "\n"; }
151#else
152 #define TGUI_PRINT_WARNING(msg)
153#endif
154
155#if !defined(NDEBUG) && !defined(TGUI_DISABLE_ASSERTS)
156 #include <iostream>
157 #include <cassert>
158 #define TGUI_ASSERT(condition, msg) { if (!(condition)) { std::cerr << "TGUI assertion: " << msg << "\n"; assert(condition); } }
159#else
160 #define TGUI_ASSERT(condition, msg)
161#endif
162
163// Using [=] gives a warning in c++20, but using [=,this] may not compile with older c++ versions
164#if __cplusplus > 201703L
165 #define TGUI_LAMBDA_CAPTURE_EQ_THIS [=,this]
166#else
167 #define TGUI_LAMBDA_CAPTURE_EQ_THIS [=]
168#endif
169
170
171// Version of the library
172#define TGUI_VERSION_MAJOR 0
173#define TGUI_VERSION_MINOR 9
174#define TGUI_VERSION_PATCH 5
175
176#endif // TGUI_CONFIG_HPP