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 3
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 
113 
115 // Define a portable boolean type
117 typedef int sfBool;
118 #define sfFalse 0
119 #define sfTrue 1
120 
121 
123 // Define portable fixed-size types
125 
126 // All "common" platforms use the same size for char, short and int
127 // (basically there are 3 types for 3 sizes, so no other match is possible),
128 // we can use them without doing any kind of check
129 
130 // 8 bits integer types
131 typedef signed char sfInt8;
132 typedef unsigned char sfUint8;
133 
134 // 16 bits integer types
135 typedef signed short sfInt16;
136 typedef unsigned short sfUint16;
137 
138 // 32 bits integer types
139 typedef signed int sfInt32;
140 typedef unsigned int sfUint32;
141 
142 // 64 bits integer types
143 #if defined(_MSC_VER)
144  typedef signed __int64 sfInt64;
145  typedef unsigned __int64 sfUint64;
146 #else
147  typedef signed long long sfInt64;
148  typedef unsigned long long sfUint64;
149 #endif
150 
151 
152 #endif // SFML_CONFIG_H
signed long long sfInt64
Definition: Config.h:147
unsigned long long sfUint64
Definition: Config.h:148
signed char sfInt8
Definition: Config.h:131
signed short sfInt16
Definition: Config.h:135
int sfBool
Definition: Config.h:117
signed int sfInt32
Definition: Config.h:139
unsigned short sfUint16
Definition: Config.h:136
unsigned int sfUint32
Definition: Config.h:140
unsigned char sfUint8
Definition: Config.h:132