SFML logo
  • Main Page
  • Namespaces
  • Classes
  • Files
  • File List

Config.hpp

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 
00028 
00030 // Identify the operating system
00032 #if defined(_WIN32) || defined(__WIN32__)
00033 
00034     // Windows
00035     #define SFML_SYSTEM_WINDOWS
00036     #ifndef WIN32_LEAN_AND_MEAN
00037         #define WIN32_LEAN_AND_MEAN
00038     #endif
00039     #ifndef NOMINMAX
00040         #define NOMINMAX
00041     #endif
00042 
00043 #elif defined(linux) || defined(__linux)
00044 
00045     // Linux
00046     #define SFML_SYSTEM_LINUX
00047 
00048 #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
00049 
00050     // MacOS
00051     #define SFML_SYSTEM_MACOS
00052 
00053 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
00054 
00055     // FreeBSD
00056     #define SFML_SYSTEM_FREEBSD
00057 
00058 #else
00059 
00060     // Unsupported system
00061     #error This operating system is not supported by SFML library
00062 
00063 #endif
00064 
00065 
00067 // Identify the endianess
00069 #if defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || (defined(__MIPS__) && defined(__MISPEB__)) || \
00070     defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || defined(__sparc__) || defined(__hppa__)
00071 
00072     // Big endian
00073     #define SFML_ENDIAN_BIG
00074 
00075 #else
00076 
00077     // Little endian
00078     #define SFML_ENDIAN_LITTLE
00079 
00080 #endif
00081 
00082 
00084 // Define a portable debug macro
00086 #if !defined(NDEBUG)
00087 
00088     #define SFML_DEBUG
00089 
00090 #endif
00091 
00092 
00094 // Define portable import / export macros
00096 #if defined(SFML_SYSTEM_WINDOWS)
00097 
00098     #ifdef SFML_DYNAMIC
00099 
00100         // Windows platforms
00101         #ifdef SFML_EXPORTS
00102 
00103             // From DLL side, we must export
00104             #define SFML_API __declspec(dllexport)
00105 
00106         #else
00107 
00108             // From client application side, we must import
00109             #define SFML_API __declspec(dllimport)
00110 
00111         #endif
00112 
00113         // For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
00114         // You can read lots ot different things about it, but the point is the code will
00115         // just work fine, and so the simplest way to get rid of this warning is to disable it
00116         #ifdef _MSC_VER
00117 
00118             #pragma warning(disable : 4251)
00119 
00120         #endif
00121 
00122     #else
00123 
00124         // No specific directive needed for static build
00125         #define SFML_API
00126 
00127     #endif
00128 
00129 #else
00130 
00131     // Other platforms don't need to define anything
00132     #define SFML_API
00133 
00134 #endif
00135 
00136 
00138 // Define portable fixed-size types
00140 #include <climits>
00141 
00142 namespace sf
00143 {
00144     // 8 bits integer types
00145     #if UCHAR_MAX == 0xFF
00146         typedef signed   char Int8;
00147         typedef unsigned char Uint8;
00148     #else
00149         #error No 8 bits integer type for this platform
00150     #endif
00151 
00152     // 16 bits integer types
00153     #if USHRT_MAX == 0xFFFF
00154         typedef signed   short Int16;
00155         typedef unsigned short Uint16;
00156     #elif UINT_MAX == 0xFFFF
00157         typedef signed   int Int16;
00158         typedef unsigned int Uint16;
00159     #elif ULONG_MAX == 0xFFFF
00160         typedef signed   long Int16;
00161         typedef unsigned long Uint16;
00162     #else
00163         #error No 16 bits integer type for this platform
00164     #endif
00165 
00166     // 32 bits integer types
00167     #if USHRT_MAX == 0xFFFFFFFF
00168         typedef signed   short Int32;
00169         typedef unsigned short Uint32;
00170     #elif UINT_MAX == 0xFFFFFFFF
00171         typedef signed   int Int32;
00172         typedef unsigned int Uint32;
00173     #elif ULONG_MAX == 0xFFFFFFFF
00174         typedef signed   long Int32;
00175         typedef unsigned long Uint32;
00176     #else
00177         #error No 32 bits integer type for this platform
00178     #endif
00179 
00180 } // namespace sf
00181 
00182 
00183 #endif // SFML_CONFIG_HPP

 ::  Copyright © 2007-2008 Laurent Gomila, all rights reserved  ::  Documentation generated by doxygen 1.5.2  ::