1////////////////////////////////////////////////////////////
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2020 Laurent Gomila (laurent@sfml-dev.org)
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//
23////////////////////////////////////////////////////////////
24
25#ifndef SFML_CONFIG_HPP
26#define SFML_CONFIG_HPP
27
28
29////////////////////////////////////////////////////////////
30// Define the SFML version
31////////////////////////////////////////////////////////////
32#define SFML_VERSION_MAJOR 2
33#define SFML_VERSION_MINOR 5
34#define SFML_VERSION_PATCH 1
35
36
37////////////////////////////////////////////////////////////
38// Identify the operating system
39// see https://sourceforge.net/p/predef/wiki/Home/
40////////////////////////////////////////////////////////////
41#if defined(_WIN32)
42
43 // Windows
44 #define SFML_SYSTEM_WINDOWS
45 #ifndef NOMINMAX
46 #define NOMINMAX
47 #endif
48
49#elif defined(__APPLE__) && defined(__MACH__)
50
51 // Apple platform, see which one it is
52 #include "TargetConditionals.h"
53
54 #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
55
56 // iOS
57 #define SFML_SYSTEM_IOS
58
59 #elif TARGET_OS_MAC
60
61 // MacOS
62 #define SFML_SYSTEM_MACOS
63
64 #else
65
66 // Unsupported Apple system
67 #error This Apple operating system is not supported by SFML library
68
69 #endif
70
71#elif defined(__unix__)
72
73 // UNIX system, see which one it is
74 #if defined(__ANDROID__)
75
76 // Android
77 #define SFML_SYSTEM_ANDROID
78
79 #elif defined(__linux__)
80
81 // Linux
82 #define SFML_SYSTEM_LINUX
83
84 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
85
86 // FreeBSD
87 #define SFML_SYSTEM_FREEBSD
88
89 #elif defined(__OpenBSD__)
90
91 // OpenBSD
92 #define SFML_SYSTEM_OPENBSD
93
94 #else
95
96 // Unsupported UNIX system
97 #error This UNIX operating system is not supported by SFML library
98
99 #endif
100
101#else
102
103 // Unsupported system
104 #error This operating system is not supported by SFML library
105
106#endif
107
108
109////////////////////////////////////////////////////////////
110// Define a portable debug macro
111////////////////////////////////////////////////////////////
112#if !defined(NDEBUG)
113
114 #define SFML_DEBUG
115
116#endif
117
118
119////////////////////////////////////////////////////////////
120// Define helpers to create portable import / export macros for each module
121////////////////////////////////////////////////////////////
122#if !defined(SFML_STATIC)
123
124 #if defined(SFML_SYSTEM_WINDOWS)
125
126 // Windows compilers need specific (and different) keywords for export and import
127 #define SFML_API_EXPORT __declspec(dllexport)
128 #define SFML_API_IMPORT __declspec(dllimport)
129
130 // For Visual C++ compilers, we also need to turn off this annoying C4251 warning
131 #ifdef _MSC_VER
132
133 #pragma warning(disable: 4251)
134
135 #endif
136
137 #else // Linux, FreeBSD, Mac OS X
138
139 #if __GNUC__ >= 4
140
141 // GCC 4 has special keywords for showing/hidding symbols,
142 // the same keyword is used for both importing and exporting
143 #define SFML_API_EXPORT __attribute__ ((__visibility__ ("default")))
144 #define SFML_API_IMPORT __attribute__ ((__visibility__ ("default")))
145
146 #else
147
148 // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
149 #define SFML_API_EXPORT
150 #define SFML_API_IMPORT
151
152 #endif
153
154 #endif
155
156#else
157
158 // Static build doesn't need import/export macros
159 #define SFML_API_EXPORT
160 #define SFML_API_IMPORT
161
162#endif
163
164
165////////////////////////////////////////////////////////////
166// Cross-platform warning for deprecated functions and classes
167//
168// Usage:
169// class SFML_DEPRECATED MyClass
170// {
171// SFML_DEPRECATED void memberFunc();
172// };
173//
174// SFML_DEPRECATED void globalFunc();
175////////////////////////////////////////////////////////////
176#if defined(SFML_NO_DEPRECATED_WARNINGS)
177
178 // User explicitly requests to disable deprecation warnings
179 #define SFML_DEPRECATED
180
181#elif defined(_MSC_VER)
182
183 // Microsoft C++ compiler
184 // Note: On newer MSVC versions, using deprecated functions causes a compiler error. In order to
185 // trigger a warning instead of an error, the compiler flag /sdl- (instead of /sdl) must be specified.
186 #define SFML_DEPRECATED __declspec(deprecated)
187
188#elif defined(__GNUC__)
189
190 // g++ and Clang
191 #define SFML_DEPRECATED __attribute__ ((deprecated))
192
193#else
194
195 // Other compilers are not supported, leave class or function as-is.
196 // With a bit of luck, the #pragma directive works, otherwise users get a warning (no error!) for unrecognized #pragma.
197 #pragma message("SFML_DEPRECATED is not supported for your compiler, please contact the SFML team")
198 #define SFML_DEPRECATED
199
200#endif
201
202
203////////////////////////////////////////////////////////////
204// Define portable fixed-size types
205////////////////////////////////////////////////////////////
206namespace sf
207{
208 // All "common" platforms use the same size for char, short and int
209 // (basically there are 3 types for 3 sizes, so no other match is possible),
210 // we can use them without doing any kind of check
211
212 // 8 bits integer types
213 typedef signed char Int8;
214 typedef unsigned char Uint8;
215
216 // 16 bits integer types
217 typedef signed short Int16;
218 typedef unsigned short Uint16;
219
220 // 32 bits integer types
221 typedef signed int Int32;
222 typedef unsigned int Uint32;
223
224 // 64 bits integer types
225 #if defined(_MSC_VER)
226 typedef signed __int64 Int64;
227 typedef unsigned __int64 Uint64;
228 #else
229 typedef signed long long Int64;
230 typedef unsigned long long Uint64;
231 #endif
232
233} // namespace sf
234
235
236#endif // SFML_CONFIG_HPP
237