Back to index

libsfml  1.6+dfsg2
Config.hpp
Go to the documentation of this file.
00001 
00002 //
00003 // SFML - Simple and Fast Multimedia Library
00004 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
00005 //
00006 // This software is provided 'as-is', without any express or implied warranty.
00007 // In no event will the authors be held liable for any damages arising from the use of this software.
00008 //
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it freely,
00011 // subject to the following restrictions:
00012 //
00013 // 1. The origin of this software must not be misrepresented;
00014 //    you must not claim that you wrote the original software.
00015 //    If you use this software in a product, an acknowledgment
00016 //    in the product documentation would be appreciated but is not required.
00017 //
00018 // 2. Altered source versions must be plainly marked as such,
00019 //    and must not be misrepresented as being the original software.
00020 //
00021 // 3. This notice may not be removed or altered from any source distribution.
00022 //
00024 
00025 #ifndef SFML_CONFIG_HPP
00026 #define SFML_CONFIG_HPP
00027 
00029 // Identify the operating system
00031 #if defined(_WIN32) || defined(__WIN32__)
00032 
00033     // Windows
00034     #define SFML_SYSTEM_WINDOWS
00035     #ifndef WIN32_LEAN_AND_MEAN
00036         #define WIN32_LEAN_AND_MEAN
00037     #endif
00038     #ifndef NOMINMAX
00039         #define NOMINMAX
00040     #endif
00041 
00042 #elif defined(linux) || defined(__linux)
00043 
00044     // Linux
00045     #define SFML_SYSTEM_LINUX
00046 
00047 #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
00048 
00049     // MacOS
00050     #define SFML_SYSTEM_MACOS
00051 
00052 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
00053 
00054     // FreeBSD
00055     #define SFML_SYSTEM_FREEBSD
00056 
00057 #else
00058 
00059     // Unsupported system
00060     #error This operating system is not supported by SFML library
00061 
00062 #endif
00063 
00064 
00066 // Define a portable debug macro
00068 #if !defined(NDEBUG)
00069 
00070     #define SFML_DEBUG
00071 
00072 #endif
00073 
00074 
00076 // Define portable import / export macros
00078 #if defined(SFML_SYSTEM_WINDOWS)
00079 
00080     #ifdef SFML_DYNAMIC
00081 
00082         // Windows platforms
00083         #ifdef SFML_EXPORTS
00084 
00085             // From DLL side, we must export
00086             #define SFML_API __declspec(dllexport)
00087 
00088         #else
00089 
00090             // From client application side, we must import
00091             #define SFML_API __declspec(dllimport)
00092 
00093         #endif
00094 
00095         // For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
00096         // You can read lots ot different things about it, but the point is the code will
00097         // just work fine, and so the simplest way to get rid of this warning is to disable it
00098         #ifdef _MSC_VER
00099 
00100             #pragma warning(disable : 4251)
00101 
00102         #endif
00103 
00104     #else
00105 
00106         // No specific directive needed for static build
00107         #define SFML_API
00108 
00109     #endif
00110 
00111 #else
00112 
00113     // Other platforms don't need to define anything
00114     #define SFML_API
00115 
00116 #endif
00117 
00118 
00120 // Define portable fixed-size types
00122 #include <climits>
00123 
00124 namespace sf
00125 {
00126     // 8 bits integer types
00127     #if UCHAR_MAX == 0xFF
00128         typedef signed   char Int8;
00129         typedef unsigned char Uint8;
00130     #else
00131         #error No 8 bits integer type for this platform
00132     #endif
00133 
00134     // 16 bits integer types
00135     #if USHRT_MAX == 0xFFFF
00136         typedef signed   short Int16;
00137         typedef unsigned short Uint16;
00138     #elif UINT_MAX == 0xFFFF
00139         typedef signed   int Int16;
00140         typedef unsigned int Uint16;
00141     #elif ULONG_MAX == 0xFFFF
00142         typedef signed   long Int16;
00143         typedef unsigned long Uint16;
00144     #else
00145         #error No 16 bits integer type for this platform
00146     #endif
00147 
00148     // 32 bits integer types
00149     #if USHRT_MAX == 0xFFFFFFFF
00150         typedef signed   short Int32;
00151         typedef unsigned short Uint32;
00152     #elif UINT_MAX == 0xFFFFFFFF
00153         typedef signed   int Int32;
00154         typedef unsigned int Uint32;
00155     #elif ULONG_MAX == 0xFFFFFFFF
00156         typedef signed   long Int32;
00157         typedef unsigned long Uint32;
00158     #else
00159         #error No 32 bits integer type for this platform
00160     #endif
00161 
00162 } // namespace sf
00163 
00164 
00165 #endif // SFML_CONFIG_HPP