TGUI  0.9.1
Config.hpp
1 //
3 // TGUI - Texus' Graphical User Interface
4 // Copyright (C) 2012-2021 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  #define TGUI_API
75 #endif
76 
77 // Use OpenGL ES on mobile platforms (in backends that use OpenGL directly)
78 #define TGUI_USE_GLES 0
79 
80 // Enables code that relies on a specific backend
81 #define TGUI_HAS_BACKEND_SFML 1
82 #define TGUI_HAS_BACKEND_SDL 1
83 
84 // Define that specifies the mininmum c++ support in both the TGUI code and user code.
85 // This constant can be lower than the actual c++ standard version used to compile with,
86 // as long as this constant is the same when compiling TGUI and when using the TGUI libs.
87 #define TGUI_COMPILED_WITH_CPP_VER 14
88 
89 // Include the version header when c++20 is available to use the library feature-testing macros
90 #if TGUI_COMPILED_WITH_CPP_VER >= 20
91  #include <version>
92 #endif
93 
94 // Enable the use of std::filesystem if TGUI is built with c++17 with a new enough compiler.
95 // Although GCC and clang supported it before version 9, this is the first version where no
96 // additional library has to be linked in order to use std::filesystem. This is also the
97 // reason why we can't rely on __cpp_lib_filesystem for this.
98 #if TGUI_COMPILED_WITH_CPP_VER >= 17
99  #if defined(__clang_major__) && (__clang_major__ >= 9) \
100  || defined(__GNUC__) && (__GNUC__ >= 9) \
101  || defined(_MSC_VER) && (_MSC_VER >= 1914)
102  #define TGUI_USE_STD_FILESYSTEM
103  #endif
104 #endif
105 
106 // No compiler supports clock_cast yet, so enabling the following define has never been tested
107 //#if __cpp_lib_chrono >= 201907L && defined(TGUI_USE_STD_FILESYSTEM)
108 // #define TGUI_USE_STD_FILESYSTEM_FILE_TIME
109 //#endif
110 
111 #if defined(__cpp_constexpr) && (__cpp_constexpr >= 201304L)
112  #define TGUI_CONSTEXPR constexpr
113 #else
114  #define TGUI_CONSTEXPR inline
115 #endif
116 
117 #if __cplusplus >= 201703L
118  #define TGUI_EMPLACE_BACK(object, vector) auto& object = vector.emplace_back();
119 #else
120  #define TGUI_EMPLACE_BACK(object, vector) vector.emplace_back(); auto& object = vector.back();
121 #endif
122 
123 #ifndef TGUI_NO_DEPRECATED_WARNINGS
124  #define TGUI_DEPRECATED(msg) [[deprecated(msg)]]
125 #else
126  #define TGUI_DEPRECATED(msg)
127 #endif
128 
129 #if !defined(NDEBUG) && !defined(TGUI_NO_RUNTIME_WARNINGS)
130  #include <iostream>
131  #define TGUI_PRINT_WARNING(msg) { std::cerr << "TGUI warning: " << msg << "\n"; }
132 #else
133  #define TGUI_PRINT_WARNING(msg)
134 #endif
135 
136 #if !defined(NDEBUG) && !defined(TGUI_DISABLE_ASSERTS)
137  #include <iostream>
138  #include <cassert>
139  #define TGUI_ASSERT(condition, msg) { if (!(condition)) { std::cerr << "TGUI assertion: " << msg << "\n"; assert(condition); } }
140 #else
141  #define TGUI_ASSERT(condition, msg)
142 #endif
143 
144 // Using [=] gives a warning in c++20, but using [=,this] may not compile with older c++ versions
145 #if __cplusplus > 201703L
146  #define TGUI_LAMBDA_CAPTURE_EQ_THIS [=,this]
147 #else
148  #define TGUI_LAMBDA_CAPTURE_EQ_THIS [=]
149 #endif
150 
151 
152 // Version of the library
153 #define TGUI_VERSION_MAJOR 0
154 #define TGUI_VERSION_MINOR 9
155 #define TGUI_VERSION_PATCH 1
156 
157 #endif // TGUI_CONFIG_HPP