]> git.sesse.net Git - casparcg/blob - SFML-1.6/include/SFML/Config.hpp
(no commit message)
[casparcg] / SFML-1.6 / include / SFML / Config.hpp
1 ////////////////////////////////////////////////////////////\r
2 //\r
3 // SFML - Simple and Fast Multimedia Library\r
4 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)\r
5 //\r
6 // This software is provided 'as-is', without any express or implied warranty.\r
7 // In no event will the authors be held liable for any damages arising from the use of this software.\r
8 //\r
9 // Permission is granted to anyone to use this software for any purpose,\r
10 // including commercial applications, and to alter it and redistribute it freely,\r
11 // subject to the following restrictions:\r
12 //\r
13 // 1. The origin of this software must not be misrepresented;\r
14 //    you must not claim that you wrote the original software.\r
15 //    If you use this software in a product, an acknowledgment\r
16 //    in the product documentation would be appreciated but is not required.\r
17 //\r
18 // 2. Altered source versions must be plainly marked as such,\r
19 //    and must not be misrepresented as being the original software.\r
20 //\r
21 // 3. This notice may not be removed or altered from any source distribution.\r
22 //\r
23 ////////////////////////////////////////////////////////////\r
24 \r
25 #ifndef SFML_CONFIG_HPP\r
26 #define SFML_CONFIG_HPP\r
27 \r
28 ////////////////////////////////////////////////////////////\r
29 // Identify the operating system\r
30 ////////////////////////////////////////////////////////////\r
31 #if defined(_WIN32) || defined(__WIN32__)\r
32 \r
33     // Windows\r
34     #define SFML_SYSTEM_WINDOWS\r
35     #ifndef WIN32_LEAN_AND_MEAN\r
36         #define WIN32_LEAN_AND_MEAN\r
37     #endif\r
38     #ifndef NOMINMAX\r
39         #define NOMINMAX\r
40     #endif\r
41 \r
42 #elif defined(linux) || defined(__linux)\r
43 \r
44     // Linux\r
45     #define SFML_SYSTEM_LINUX\r
46 \r
47 #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)\r
48 \r
49     // MacOS\r
50     #define SFML_SYSTEM_MACOS\r
51 \r
52 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\r
53 \r
54     // FreeBSD\r
55     #define SFML_SYSTEM_FREEBSD\r
56 \r
57 #else\r
58 \r
59     // Unsupported system\r
60     #error This operating system is not supported by SFML library\r
61 \r
62 #endif\r
63 \r
64 \r
65 ////////////////////////////////////////////////////////////\r
66 // Define a portable debug macro\r
67 ////////////////////////////////////////////////////////////\r
68 #if !defined(NDEBUG)\r
69 \r
70     #define SFML_DEBUG\r
71 \r
72 #endif\r
73 \r
74 \r
75 ////////////////////////////////////////////////////////////\r
76 // Define portable import / export macros\r
77 ////////////////////////////////////////////////////////////\r
78 #if defined(SFML_SYSTEM_WINDOWS)\r
79 \r
80     #ifdef SFML_DYNAMIC\r
81 \r
82         // Windows platforms\r
83         #ifdef SFML_EXPORTS\r
84 \r
85             // From DLL side, we must export\r
86             #define SFML_API __declspec(dllexport)\r
87 \r
88         #else\r
89 \r
90             // From client application side, we must import\r
91             #define SFML_API __declspec(dllimport)\r
92 \r
93         #endif\r
94 \r
95         // For Visual C++ compilers, we also need to turn off this annoying C4251 warning.\r
96         // You can read lots ot different things about it, but the point is the code will\r
97         // just work fine, and so the simplest way to get rid of this warning is to disable it\r
98         #ifdef _MSC_VER\r
99 \r
100             #pragma warning(disable : 4251)\r
101 \r
102         #endif\r
103 \r
104     #else\r
105 \r
106         // No specific directive needed for static build\r
107         #define SFML_API\r
108 \r
109     #endif\r
110 \r
111 #else\r
112 \r
113     // Other platforms don't need to define anything\r
114     #define SFML_API\r
115 \r
116 #endif\r
117 \r
118 \r
119 ////////////////////////////////////////////////////////////\r
120 // Define portable fixed-size types\r
121 ////////////////////////////////////////////////////////////\r
122 #include <climits>\r
123 \r
124 namespace sf\r
125 {\r
126     // 8 bits integer types\r
127     #if UCHAR_MAX == 0xFF\r
128         typedef signed   char Int8;\r
129         typedef unsigned char Uint8;\r
130     #else\r
131         #error No 8 bits integer type for this platform\r
132     #endif\r
133 \r
134     // 16 bits integer types\r
135     #if USHRT_MAX == 0xFFFF\r
136         typedef signed   short Int16;\r
137         typedef unsigned short Uint16;\r
138     #elif UINT_MAX == 0xFFFF\r
139         typedef signed   int Int16;\r
140         typedef unsigned int Uint16;\r
141     #elif ULONG_MAX == 0xFFFF\r
142         typedef signed   long Int16;\r
143         typedef unsigned long Uint16;\r
144     #else\r
145         #error No 16 bits integer type for this platform\r
146     #endif\r
147 \r
148     // 32 bits integer types\r
149     #if USHRT_MAX == 0xFFFFFFFF\r
150         typedef signed   short Int32;\r
151         typedef unsigned short Uint32;\r
152     #elif UINT_MAX == 0xFFFFFFFF\r
153         typedef signed   int Int32;\r
154         typedef unsigned int Uint32;\r
155     #elif ULONG_MAX == 0xFFFFFFFF\r
156         typedef signed   long Int32;\r
157         typedef unsigned long Uint32;\r
158     #else\r
159         #error No 32 bits integer type for this platform\r
160     #endif\r
161 \r
162 } // namespace sf\r
163 \r
164 \r
165 #endif // SFML_CONFIG_HPP\r