source: OGRE/trunk/ogrenew/OgreMain/include/OgrePlatform.h @ 657

Revision 657, 6.0 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

RevLine 
[657]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#else
74#   define FORCEINLINE __inline
75#endif
76
77/* Finds the current platform */
78
79#if defined( __WIN32__ ) || defined( _WIN32 )
80#   define OGRE_PLATFORM OGRE_PLATFORM_WIN32
81
82#elif defined( __APPLE_CC__)
83#   define OGRE_PLATFORM OGRE_PLATFORM_APPLE
84
85#else
86#   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
87#endif
88
89/* Find the arch type */
90#if defined(__x86_64__)
91#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
92#else
93#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
94#endif
95// For generating compiler warnings - should work on any compiler
96// As a side note, if you start your message with 'Warning: ', the MSVC
97// IDE actually does catch a warning :)
98#define OGRE_QUOTE_INPLACE(x) # x
99#define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
100#define OGRE_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
101
102//----------------------------------------------------------------------------
103// Windows Settings
104#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
105
106// If we're not including this from a client build, specify that the stuff
107// should get exported. Otherwise, import it.
108#       if defined( __MINGW32__ )
109                // Linux compilers don't have symbol import/export directives.
110#       define _OgreExport
111#       define _OgrePrivate
112#   else
113#       if defined( OGRE_NONCLIENT_BUILD )
114#               define _OgreExport __declspec( dllexport )
115#       else
116#               define _OgreExport __declspec( dllimport )
117#       endif
118#       define _OgrePrivate
119#       endif
120// Win32 compilers use _DEBUG for specifying debug builds.
121#   ifdef _DEBUG
122#       define OGRE_DEBUG_MODE 1
123#   else
124#       define OGRE_DEBUG_MODE 0
125#   endif
126
127#if defined( __MINGW32__ )
128    #define EXT_HASH
129#else
130    #define snprintf _snprintf
131    #define vsnprintf _vsnprintf
132#endif
133
134#if OGRE_DEBUG_MODE
135    #define OGRE_PLATFORM_LIB "OgrePlatform_d.dll"
136#else
137    #define OGRE_PLATFORM_LIB "OgrePlatform.dll"
138#endif
139
140#endif
141//----------------------------------------------------------------------------
142
143//----------------------------------------------------------------------------
144// Linux/Apple Settings
145#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
146
147// Enable GCC 4.0 symbol visibility
148#   if OGRE_COMP_VER >= 400
149#       define _OgreExport  __attribute__ ((visibility("default")))
150#       define _OgrePrivate __attribute__ ((visibility("hidden")))
151#   else
152#       define _OgreExport
153#       define _OgrePrivate
154#   endif
155
156// A quick define to overcome different names for the same function
157#   define stricmp strcasecmp
158
159// Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
160// specifying a debug build.
161#   ifdef DEBUG
162#       define OGRE_DEBUG_MODE 1
163#   else
164#       define OGRE_DEBUG_MODE 0
165#   endif
166
167#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
168    #define OGRE_PLATFORM_LIB "OgrePlatform.bundle"
169#else
170    //OGRE_PLATFORM_LINUX
171    #define OGRE_PLATFORM_LIB "libOgrePlatform.so"
172#endif
173
174#endif
175
176//For apple, we always have a custom config.h file
177#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
178#    include "config.h"
179//SDL_main must be included in the file that contains
180//the application's main() function.
181#ifndef OGRE_NONCLIENT_BUILD
182#   include <SDL/SDL_main.h>
183#endif
184
185#endif
186
187//----------------------------------------------------------------------------
188
189//----------------------------------------------------------------------------
190// Endian Settings
191// check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
192#ifdef CONFIG_BIG_ENDIAN
193#    define OGRE_ENDIAN OGRE_ENDIAN_BIG
194#else
195#    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
196#endif
197
198// Integer formats of fixed bit width
199typedef unsigned int uint32;
200typedef unsigned short uint16;
201typedef unsigned char uint8;
202
203}
204
205#endif
Note: See TracBrowser for help on using the repository browser.