CSFML - C binding of the Simple and Fast Multimedia Library

CSFML
Config.h
Go to the documentation of this file.
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2015 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 //
24
25 #ifndef SFML_CONFIG_H
26 #define SFML_CONFIG_H
27
28
30 // Define the CSFML version
32 #define CSFML_VERSION_MAJOR 2
33 #define CSFML_VERSION_MINOR 4
34 #define CSFML_VERSION_PATCH 0
35
36
38 // Check if we need to mark functions as extern "C"
40 #ifdef __cplusplus
41 #define CSFML_EXTERN_C extern "C"
42 #else
43 #define CSFML_EXTERN_C extern
44 #endif
45
46
48 // Identify the operating system
50 #if defined(_WIN32) || defined(__WIN32__)
51
52 // Windows
53 #define CSFML_SYSTEM_WINDOWS
54
55 #elif defined(linux) || defined(__linux)
56
57 // Linux
58 #define CSFML_SYSTEM_LINUX
59
60 #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
61
62 // MacOS
63 #define CSFML_SYSTEM_MACOS
64
65 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
66
67 // FreeBSD
68 #define CSFML_SYSTEM_FREEBSD
69
70 #else
71
72 // Unsupported system
73 #error This operating system is not supported by SFML library
74
75 #endif
76
77
79 // Define helpers to create portable import / export macros for each module
81 #if defined(CSFML_SYSTEM_WINDOWS)
82
83 // Windows compilers need specific (and different) keywords for export and import
84 #define CSFML_API_EXPORT extern "C" __declspec(dllexport)
85 #define CSFML_API_IMPORT CSFML_EXTERN_C __declspec(dllimport)
86
87 // For Visual C++ compilers, we also need to turn off this annoying C4251 warning
88 #ifdef _MSC_VER
89
90 #pragma warning(disable : 4251)
91
92 #endif
93
94 #else // Linux, FreeBSD, Mac OS X
95
96 #if __GNUC__ >= 4
97
98 // GCC 4 has special keywords for showing/hidding symbols,
99 // the same keyword is used for both importing and exporting
100 #define CSFML_API_EXPORT extern "C" __attribute__ ((__visibility__ ("default")))
101 #define CSFML_API_IMPORT CSFML_EXTERN_C __attribute__ ((__visibility__ ("default")))
102
103 #else
104
105 // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
106 #define CSFML_API_EXPORT extern "C"
107 #define CSFML_API_IMPORT CSFML_EXTERN_C
108
109 #endif
110
111 #endif
112
114 // Cross-platform warning for deprecated functions and classes
115 //
116 // Usage:
117 // struct CSFML_DEPRECATED MyStruct
118 // {
119 // ...
120 // };
121 //
122 // CSFML_DEPRECATED void globalFunc();
124 #if defined(CSFML_NO_DEPRECATED_WARNINGS)
125
126 // User explicitly requests to disable deprecation warnings
127 #define CSFML_DEPRECATED
128
129 #elif defined(_MSC_VER)
130
131 // Microsoft C++ compiler
132 // Note: On newer MSVC versions, using deprecated functions causes a compiler error. In order to
133 // trigger a warning instead of an error, the compiler flag /sdl- (instead of /sdl) must be specified.
134 #define CSFML_DEPRECATED __declspec(deprecated)
135
136 #elif defined(__GNUC__)
137
138 // g++ and Clang
139 #define CSFML_DEPRECATED __attribute__ ((deprecated))
140
141 #else
142
143 // Other compilers are not supported, leave class or function as-is.
144 // With a bit of luck, the #pragma directive works, otherwise users get a warning (no error!) for unrecognized #pragma.
145 #pragma message("CSFML_DEPRECATED is not supported for your compiler, please contact the CSFML team")
146 #define CSFML_DEPRECATED
147
148 #endif
149
151 // Define a portable boolean type
153 typedef int sfBool;
154 #define sfFalse 0
155 #define sfTrue 1
156
157
159 // Define portable fixed-size types
161
162 // All "common" platforms use the same size for char, short and int
163 // (basically there are 3 types for 3 sizes, so no other match is possible),
164 // we can use them without doing any kind of check
165
166 // 8 bits integer types
167 typedef signed char sfInt8;
168 typedef unsigned char sfUint8;
169
170 // 16 bits integer types
171 typedef signed short sfInt16;
172 typedef unsigned short sfUint16;
173
174 // 32 bits integer types
175 typedef signed int sfInt32;
176 typedef unsigned int sfUint32;
177
178 // 64 bits integer types
179 #if defined(_MSC_VER)
180 typedef signed __int64 sfInt64;
181 typedef unsigned __int64 sfUint64;
182 #else
183 typedef signed long long sfInt64;
184 typedef unsigned long long sfUint64;
185 #endif
186
187
188 #endif // SFML_CONFIG_H
sfInt64
signed long long sfInt64
Definition: Config.h:183
sfUint64
unsigned long long sfUint64
Definition: Config.h:184
sfInt8
signed char sfInt8
Definition: Config.h:167
sfInt16
signed short sfInt16
Definition: Config.h:171
sfBool
int sfBool
Definition: Config.h:153
sfInt32
signed int sfInt32
Definition: Config.h:175
sfUint16
unsigned short sfUint16
Definition: Config.h:172
sfUint32
unsigned int sfUint32
Definition: Config.h:176
sfUint8
unsigned char sfUint8
Definition: Config.h:168