TGUI  0.8.0
Config.hpp
1 //
3 // TGUI - Texus' Graphical User Interface
4 // Copyright (C) 2012-2018 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 #include <SFML/Config.hpp>
29 
30 // TGUI will link in the same way as SFML, unless TGUI_DYNAMIC or TGUI_STATIC is defined
31 #if !defined(TGUI_DYNAMIC) && !defined(TGUI_STATIC)
32  #ifdef SFML_STATIC
33  #define TGUI_STATIC
34  #endif
35 #endif
36 
37 #ifndef TGUI_STATIC
38  #ifdef SFML_SYSTEM_WINDOWS
39  // Windows compilers need specific (and different) keywords for export and import
40  #ifdef TGUI_EXPORTS
41  #define TGUI_API __declspec(dllexport)
42  #else
43  #define TGUI_API __declspec(dllimport)
44  #endif
45  #else
46  #define TGUI_API __attribute__ ((__visibility__ ("default")))
47  #endif
48 #else
49  // Static build doesn't need import/export macros
50  #define TGUI_API
51  #define TGUI_API
52 #endif
53 
54 
55 // Version of the library
56 #define TGUI_VERSION_MAJOR 0
57 #define TGUI_VERSION_MINOR 8
58 #define TGUI_VERSION_PATCH 0
59 
60 // The signal system detects whether it can provide unbound parameters by checking the arguments of the function at runtime.
61 // This comparion is made by checking the typeid of the parameters with the typeid of the value which the widget can transmit.
62 // Although typeid returns a unique value and the operator== is guarenteed to only be true for the same type, it may not always work correctly.
63 // Dynamically linked libraries may have a different type_info internally than in the code using the library. In such case the comparison will always be false.
64 // This behavior has so far only been seen on android (using NDK 12b), so the alternative is currently only used when compiling on android.
65 // The alternative that is used on android is to compare the strings returned by type_info.name(). This is however considered undefined behavior since the compiler
66 // is not guarenteed to have unique names for different types. The names will however be the same inside and outside the library so this method solves the issue.
67 // I am also not aware of any supported compiler that does not create unique names.
68 #ifdef __ANDROID__
69  #define TGUI_UNSAFE_TYPE_INFO_COMPARISON
70 #endif
71 
72 // Enable constexpr when using Clang or at least GCC 5 or MSVC++ 14.1 (VS2017)
73 #if defined(_MSC_VER)
74  #if _MSC_VER >= 1910
75  #define TGUI_CONSTEXPR constexpr
76  #else
77  #define TGUI_CONSTEXPR
78  #endif
79 #elif defined(__GNUC__)
80  #if __cpp_constexpr >= 201304
81  #define TGUI_CONSTEXPR constexpr
82  #else
83  #define TGUI_CONSTEXPR
84  #endif
85 #else
86  #define TGUI_CONSTEXPR constexpr
87 #endif
88 
89 #ifndef TGUI_NO_DEPRECATED_WARNINGS
90  #define TGUI_DEPRECATED(msg) [[deprecated(msg)]]
91 #else
92  #define TGUI_DEPRECATED(msg)
93 #endif
94 
95 #ifndef TGUI_NO_RUNTIME_WARNINGS
96  #define TGUI_PRINT_WARNING(msg) sf::err() << "TGUI Warning: " << msg << std::endl;
97 #else
98  #define TGUI_PRINT_WARNING(msg)
99 #endif
100 
101 #endif // TGUI_CONFIG_HPP