source: GTP/trunk/Lib/Geom/OgreStuff/include/OgrePlatform.h @ 1809

Revision 1809, 6.1 KB checked in by gumbau, 18 years ago (diff)
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#ifndef __Platform_H_
26#define __Platform_H_
27
28#include "OgreConfig.h"
29
30namespace Ogre {
31/* Initial platform/compiler-related stuff to set.
32*/
33#define OGRE_PLATFORM_WIN32 1
34#define OGRE_PLATFORM_LINUX 2
35#define OGRE_PLATFORM_APPLE 3
36
37#define OGRE_COMPILER_MSVC 1
38#define OGRE_COMPILER_GNUC 2
39#define OGRE_COMPILER_BORL 3
40
41#define OGRE_ENDIAN_LITTLE 1
42#define OGRE_ENDIAN_BIG 2
43
44#define OGRE_ARCHITECTURE_32 1
45#define OGRE_ARCHITECTURE_64 2
46
47/* Finds the compiler type and version.
48*/
49#if defined( _MSC_VER )
50#   define OGRE_COMPILER OGRE_COMPILER_MSVC
51#   define OGRE_COMP_VER _MSC_VER
52
53#elif defined( __GNUC__ )
54#   define OGRE_COMPILER OGRE_COMPILER_GNUC
55#   define OGRE_COMP_VER (((__GNUC__)*100) + \
56        (__GNUC_MINOR__*10) + \
57        __GNUC_PATCHLEVEL__)
58
59#elif defined( __BORLANDC__ )
60#   define OGRE_COMPILER OGRE_COMPILER_BORL
61#   define OGRE_COMP_VER __BCPLUSPLUS__
62
63#else
64#   pragma error "No known compiler. Abort! Abort!"
65
66#endif
67
68/* See if we can use __forceinline or if we need to use __inline instead */
69#if OGRE_COMPILER == OGRE_COMPILER_MSVC
70#   if OGRE_COMP_VER >= 1200
71#       define FORCEINLINE __forceinline
72#   endif
73#elif defined(__MINGW32__)
74#   if !defined(FORCEINLINE)
75#       define FORCEINLINE __inline
76#   endif
77#else
78#   define FORCEINLINE __inline
79#endif
80
81/* Finds the current platform */
82
83#if defined( __WIN32__ ) || defined( _WIN32 )
84#   define OGRE_PLATFORM OGRE_PLATFORM_WIN32
85
86#elif defined( __APPLE_CC__)
87#   define OGRE_PLATFORM OGRE_PLATFORM_APPLE
88
89#else
90#   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
91#endif
92
93    /* Find the arch type */
94#if defined(__x86_64__) || defined(_M_X64)
95#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
96#else
97#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
98#endif
99
100// For generating compiler warnings - should work on any compiler
101// As a side note, if you start your message with 'Warning: ', the MSVC
102// IDE actually does catch a warning :)
103#define OGRE_QUOTE_INPLACE(x) # x
104#define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
105#define OGRE_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
106
107//----------------------------------------------------------------------------
108// Windows Settings
109#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
110
111// If we're not including this from a client build, specify that the stuff
112// should get exported. Otherwise, import it.
113#       if defined( __MINGW32__ )
114                // Linux compilers don't have symbol import/export directives.
115#       define _OgreExport
116#       define _OgrePrivate
117#   else
118#       if defined( OGRE_NONCLIENT_BUILD )
119#               define _OgreExport __declspec( dllexport )
120#       else
121#               define _OgreExport __declspec( dllimport )
122#       endif
123#       define _OgrePrivate
124#       endif
125// Win32 compilers use _DEBUG for specifying debug builds.
126#   ifdef _DEBUG
127#       define OGRE_DEBUG_MODE 1
128#   else
129#       define OGRE_DEBUG_MODE 0
130#   endif
131
132#if defined( __MINGW32__ )
133    #define EXT_HASH
134#else
135    #define snprintf _snprintf
136    #define vsnprintf _vsnprintf
137#endif
138
139#if OGRE_DEBUG_MODE
140    #define OGRE_PLATFORM_LIB "OgrePlatform_d.dll"
141#else
142    #define OGRE_PLATFORM_LIB "OgrePlatform.dll"
143#endif
144
145#endif
146//----------------------------------------------------------------------------
147
148//----------------------------------------------------------------------------
149// Linux/Apple Settings
150#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
151
152// Enable GCC 4.0 symbol visibility
153#   if OGRE_COMP_VER >= 400
154#       define _OgreExport  __attribute__ ((visibility("default")))
155#       define _OgrePrivate __attribute__ ((visibility("hidden")))
156#   else
157#       define _OgreExport
158#       define _OgrePrivate
159#   endif
160
161// A quick define to overcome different names for the same function
162#   define stricmp strcasecmp
163
164// Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
165// specifying a debug build.
166#   ifdef DEBUG
167#       define OGRE_DEBUG_MODE 1
168#   else
169#       define OGRE_DEBUG_MODE 0
170#   endif
171
172#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
173    #define OGRE_PLATFORM_LIB "OgrePlatform.bundle"
174#else
175    //OGRE_PLATFORM_LINUX
176    #define OGRE_PLATFORM_LIB "libOgrePlatform.so"
177#endif
178
179#endif
180
181//For apple, we always have a custom config.h file
182#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
183#    include "config.h"
184//SDL_main must be included in the file that contains
185//the application's main() function.
186#ifndef OGRE_NONCLIENT_BUILD
187#   include <SDL/SDL_main.h>
188#endif
189
190#endif
191
192//----------------------------------------------------------------------------
193
194//----------------------------------------------------------------------------
195// Endian Settings
196// check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
197#ifdef CONFIG_BIG_ENDIAN
198#    define OGRE_ENDIAN OGRE_ENDIAN_BIG
199#else
200#    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
201#endif
202
203// Integer formats of fixed bit width
204typedef unsigned int uint32;
205typedef unsigned short uint16;
206typedef unsigned char uint8;
207
208}
209
210#endif
Note: See TracBrowser for help on using the repository browser.