Documentation de SFML 2.3.1

Attention: cette page se réfère à une ancienne version de SFML. Cliquez ici pour passer à la dernière version.
Config.hpp
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_HPP
26 #define SFML_CONFIG_HPP
27 
28 
30 // Define the SFML version
32 #define SFML_VERSION_MAJOR 2
33 #define SFML_VERSION_MINOR 3
34 #define SFML_VERSION_PATCH 1
35 
36 
38 // Identify the operating system
39 // see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
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  #else
90 
91  // Unsupported UNIX system
92  #error This UNIX operating system is not supported by SFML library
93 
94  #endif
95 
96 #else
97 
98  // Unsupported system
99  #error This operating system is not supported by SFML library
100 
101 #endif
102 
103 
105 // Define a portable debug macro
107 #if !defined(NDEBUG)
108 
109  #define SFML_DEBUG
110 
111 #endif
112 
113 
115 // Define helpers to create portable import / export macros for each module
117 #if !defined(SFML_STATIC)
118 
119  #if defined(SFML_SYSTEM_WINDOWS)
120 
121  // Windows compilers need specific (and different) keywords for export and import
122  #define SFML_API_EXPORT __declspec(dllexport)
123  #define SFML_API_IMPORT __declspec(dllimport)
124 
125  // For Visual C++ compilers, we also need to turn off this annoying C4251 warning
126  #ifdef _MSC_VER
127 
128  #pragma warning(disable: 4251)
129 
130  #endif
131 
132  #else // Linux, FreeBSD, Mac OS X
133 
134  #if __GNUC__ >= 4
135 
136  // GCC 4 has special keywords for showing/hidding symbols,
137  // the same keyword is used for both importing and exporting
138  #define SFML_API_EXPORT __attribute__ ((__visibility__ ("default")))
139  #define SFML_API_IMPORT __attribute__ ((__visibility__ ("default")))
140 
141  #else
142 
143  // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
144  #define SFML_API_EXPORT
145  #define SFML_API_IMPORT
146 
147  #endif
148 
149  #endif
150 
151 #else
152 
153  // Static build doesn't need import/export macros
154  #define SFML_API_EXPORT
155  #define SFML_API_IMPORT
156 
157 #endif
158 
159 
161 // Define portable fixed-size types
163 namespace sf
164 {
165  // All "common" platforms use the same size for char, short and int
166  // (basically there are 3 types for 3 sizes, so no other match is possible),
167  // we can use them without doing any kind of check
168 
169  // 8 bits integer types
170  typedef signed char Int8;
171  typedef unsigned char Uint8;
172 
173  // 16 bits integer types
174  typedef signed short Int16;
175  typedef unsigned short Uint16;
176 
177  // 32 bits integer types
178  typedef signed int Int32;
179  typedef unsigned int Uint32;
180 
181  // 64 bits integer types
182  #if defined(_MSC_VER)
183  typedef signed __int64 Int64;
184  typedef unsigned __int64 Uint64;
185  #else
186  typedef signed long long Int64;
187  typedef unsigned long long Uint64;
188  #endif
189 
190 } // namespace sf
191 
192 
193 #endif // SFML_CONFIG_HPP