MyGUI 3.4.1
MyGUI_Platform.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_PLATFORM_H_
8#define MYGUI_PLATFORM_H_
9
10// Definition of platforms
11#define MYGUI_PLATFORM_WIN32 1
12#define MYGUI_PLATFORM_LINUX 2
13#define MYGUI_PLATFORM_APPLE 3
14
15// Definition of compilers
16#define MYGUI_COMPILER_MSVC 1
17#define MYGUI_COMPILER_GNUC 2
18
19
20// Find platform
21#if defined (__WIN32__) || defined (_WIN32)
22# define MYGUI_PLATFORM MYGUI_PLATFORM_WIN32
23#elif defined (__APPLE_CC__)
24# define MYGUI_PLATFORM MYGUI_PLATFORM_APPLE
25#else
26# define MYGUI_PLATFORM MYGUI_PLATFORM_LINUX
27#endif
28
29// Find compiler
30#if defined( _MSC_VER )
31# define MYGUI_COMPILER MYGUI_COMPILER_MSVC
32# define MYGUI_COMP_VER _MSC_VER
33
34#elif defined( __GNUC__ )
35# define MYGUI_COMPILER MYGUI_COMPILER_GNUC
36# define MYGUI_COMP_VER (((__GNUC__)*100) + \
37 (__GNUC_MINOR__*10) + \
38 __GNUC_PATCHLEVEL__)
39#else
40# pragma error "Unknown compiler! Stop building!!!"
41#endif
42
43// Windows settings
44#if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
45#
46# if defined( MYGUI_STATIC )
47# define MYGUI_EXPORT
48# elif defined( MYGUI_BUILD )
49# define MYGUI_EXPORT __declspec( dllexport )
50# else
51# if defined( __MINGW32__ )
52# define MYGUI_EXPORT
53# else
54# define MYGUI_EXPORT __declspec( dllimport )
55# endif
56# endif
57#
58# if defined( MYGUI_STATIC )
59# define MYGUI_EXPORT_DLL
60# elif defined( MYGUI_BUILD_DLL )
61# define MYGUI_EXPORT_DLL __declspec( dllexport )
62# else
63# if defined( __MINGW32__ )
64# define MYGUI_EXPORT_DLL
65# else
66# define MYGUI_EXPORT_DLL __declspec( dllimport )
67# endif
68# endif
69#
70#// Win32 compilers use _DEBUG for specifying debug builds.
71# ifdef _DEBUG
72# define MYGUI_DEBUG_MODE 1
73# else
74# define MYGUI_DEBUG_MODE 0
75# endif
76#endif
77
78
79// Linux/Apple Settings
80#if MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX || MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
81#
82// Add -fvisibility=hidden to compiler options. With -fvisibility=hidden, you are telling
83// GCC that every declaration not explicitly marked with a visibility attribute (MYGUI_EXPORT)
84// has a hidden visibility (like in windows).
85# ifdef MYGUI_GCC_VISIBILITY
86# define MYGUI_EXPORT __attribute__ ((visibility("default")))
87# define MYGUI_EXPORT_DLL __attribute__ ((visibility("default")))
88# else
89# define MYGUI_EXPORT
90# define MYGUI_EXPORT_DLL
91# endif
92#
93// Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
94// specifying a debug build.
95// (??? this is wrong, on Linux debug builds aren't marked in any way unless
96// you mark it yourself any way you like it -- zap ???)
97# ifdef DEBUG
98# define MYGUI_DEBUG_MODE 1
99# else
100# define MYGUI_DEBUG_MODE 0
101# endif
102
103#endif
104
105#endif // MYGUI_PLATFORM_H_