Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/forks/sandbox_light/src/external/ogremath/OgrePlatform.h @ 8474

Last change on this file since 8474 was 7908, checked in by rgrieder, 14 years ago

Stripped down trunk to form a new light sandbox.

  • Property svn:eol-style set to native
File size: 6.8 KB
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-2006 Torus Knot Software Ltd
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
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef __Platform_H_
30#define __Platform_H_
31
32#include "OgreConfig.h"
33
34namespace Ogre {
35/* Initial platform/compiler-related stuff to set.
36*/
37#define OGRE_PLATFORM_WIN32 1
38#define OGRE_PLATFORM_LINUX 2
39#define OGRE_PLATFORM_APPLE 3
40
41#define OGRE_COMPILER_MSVC 1
42#define OGRE_COMPILER_GNUC 2
43#define OGRE_COMPILER_BORL 3
44
45#define OGRE_ENDIAN_LITTLE 1
46#define OGRE_ENDIAN_BIG 2
47
48#define OGRE_ARCHITECTURE_32 1
49#define OGRE_ARCHITECTURE_64 2
50
51/* Finds the compiler type and version.
52*/
53#if defined( _MSC_VER )
54#   define OGRE_COMPILER OGRE_COMPILER_MSVC
55#   define OGRE_COMP_VER _MSC_VER
56
57#elif defined( __GNUC__ )
58#   define OGRE_COMPILER OGRE_COMPILER_GNUC
59#   define OGRE_COMP_VER (((__GNUC__)*100) + \
60        (__GNUC_MINOR__*10) + \
61        __GNUC_PATCHLEVEL__)
62
63#elif defined( __BORLANDC__ )
64#   define OGRE_COMPILER OGRE_COMPILER_BORL
65#   define OGRE_COMP_VER __BCPLUSPLUS__
66#   define __FUNCTION__ __FUNC__
67#else
68#   pragma error "No known compiler. Abort! Abort!"
69
70#endif
71
72/* See if we can use __forceinline or if we need to use __inline instead */
73#if OGRE_COMPILER == OGRE_COMPILER_MSVC
74#   if OGRE_COMP_VER >= 1200
75#       define FORCEINLINE __forceinline
76#   endif
77#elif defined(__MINGW32__)
78#   if !defined(FORCEINLINE)
79#       define FORCEINLINE __inline
80#   endif
81#else
82#   define FORCEINLINE __inline
83#endif
84
85/* Finds the current platform */
86
87#if defined( __WIN32__ ) || defined( _WIN32 )
88#   define OGRE_PLATFORM OGRE_PLATFORM_WIN32
89
90#elif defined( __APPLE_CC__)
91#   define OGRE_PLATFORM OGRE_PLATFORM_APPLE
92
93#else
94#   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
95#endif
96
97    /* Find the arch type */
98#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
99#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
100#else
101#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
102#endif
103
104// For generating compiler warnings - should work on any compiler
105// As a side note, if you start your message with 'Warning: ', the MSVC
106// IDE actually does catch a warning :)
107#define OGRE_QUOTE_INPLACE(x) # x
108#define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
109#define OGRE_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
110
111//----------------------------------------------------------------------------
112// Windows Settings
113#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
114
115// If we're not including this from a client build, specify that the stuff
116// should get exported. Otherwise, import it.
117#       if defined( OGRE_STATIC_LIB )
118                // Linux compilers don't have symbol import/export directives.
119#       define _OgreExport
120#       define _OgrePrivate
121#   else
122#       if defined( OGRE_NONCLIENT_BUILD )
123#               define _OgreExport __declspec( dllexport )
124#       else
125#           if defined( __MINGW32__ )
126#               define _OgreExport
127#           else
128#                   define _OgreExport __declspec( dllimport )
129#           endif
130#       endif
131#       define _OgrePrivate
132#       endif
133// Win32 compilers use _DEBUG for specifying debug builds.
134#   ifdef _DEBUG
135#       define OGRE_DEBUG_MODE 1
136#   else
137#       define OGRE_DEBUG_MODE 0
138#   endif
139
140// Disable unicode support on MingW at the moment, poorly supported in stdlibc++
141// STLPORT fixes this though so allow if found
142// MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h
143#if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION)
144#   include<_mingw.h>
145#   if defined(__MINGW32_TOOLBOX_UNICODE__)
146#           define OGRE_UNICODE_SUPPORT 1
147#   else
148#       define OGRE_UNICODE_SUPPORT 0
149#   endif
150#else
151#       define OGRE_UNICODE_SUPPORT 1
152#endif
153
154#endif
155//----------------------------------------------------------------------------
156
157//----------------------------------------------------------------------------
158// Linux/Apple Settings
159#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
160
161// Enable GCC symbol visibility
162#   if defined( OGRE_GCC_VISIBILITY )
163#       define _OgreExport  __attribute__ ((visibility("default")))
164#       define _OgrePrivate __attribute__ ((visibility("hidden")))
165#   else
166#       define _OgreExport
167#       define _OgrePrivate
168#   endif
169
170// A quick define to overcome different names for the same function
171#   define stricmp strcasecmp
172
173// Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
174// specifying a debug build.
175// (??? this is wrong, on Linux debug builds aren't marked in any way unless
176// you mark it yourself any way you like it -- zap ???)
177#   ifdef DEBUG
178#       define OGRE_DEBUG_MODE 1
179#   else
180#       define OGRE_DEBUG_MODE 0
181#   endif
182
183#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
184    #define OGRE_PLATFORM_LIB "OgrePlatform.bundle"
185#else
186    //OGRE_PLATFORM_LINUX
187    #define OGRE_PLATFORM_LIB "libOgrePlatform.so"
188#endif
189
190// Always enable unicode support for the moment
191// Perhaps disable in old versions of gcc if necessary
192#define OGRE_UNICODE_SUPPORT 1
193
194#endif
195
196//For apple, we always have a custom config.h file
197#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
198#    include "config.h"
199#endif
200
201//----------------------------------------------------------------------------
202
203//----------------------------------------------------------------------------
204// Endian Settings
205// check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
206#ifdef OGRE_CONFIG_BIG_ENDIAN
207#    define OGRE_ENDIAN OGRE_ENDIAN_BIG
208#else
209#    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
210#endif
211
212// Integer formats of fixed bit width
213typedef unsigned int uint32;
214typedef unsigned short uint16;
215typedef unsigned char uint8;
216// define uint64 type
217#if OGRE_COMPILER == OGRE_COMPILER_MSVC
218        typedef unsigned __int64 uint64;
219#else
220        typedef unsigned long long uint64;
221#endif
222
223
224}
225
226#endif
Note: See TracBrowser for help on using the repository browser.