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

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

adding ogre 1.2 and dependencies

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