MyGUI: MyGUI_Platform.h Source File

MyGUI 3.4.3

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#elif defined(__GNUC__)
33 #define MYGUI_COMPILER MYGUI_COMPILER_GNUC
34#else
35 #pragma error "Unknown compiler! Stop building!!!"
36#endif
37
38// Windows settings
39#if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
40 #
41 #if defined(MYGUI_STATIC)
42 #define MYGUI_EXPORT
43 #elif defined(MYGUI_BUILD)
44 #define MYGUI_EXPORT __declspec(dllexport)
45 #else
46 #if defined(__MINGW32__)
47 #define MYGUI_EXPORT
48 #else
49 #define MYGUI_EXPORT __declspec(dllimport)
50 #endif
51 #endif
52 #
53 #if defined(MYGUI_STATIC)
54 #define MYGUI_EXPORT_DLL
55 #elif defined(MYGUI_BUILD_DLL)
56 #define MYGUI_EXPORT_DLL __declspec(dllexport)
57 #else
58 #if defined(__MINGW32__)
59 #define MYGUI_EXPORT_DLL
60 #else
61 #define MYGUI_EXPORT_DLL __declspec(dllimport)
62 #endif
63 #endif
64#endif
65
66
67// Linux/Apple Settings
68#if MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX || MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
69 #
70 // Add -fvisibility=hidden to compiler options. With -fvisibility=hidden, you are telling
71 // GCC that every declaration not explicitly marked with a visibility attribute (MYGUI_EXPORT)
72 // has a hidden visibility (like in windows).
73 #ifdef MYGUI_GCC_VISIBILITY
74 #define MYGUI_EXPORT __attribute__((visibility("default")))
75 #define MYGUI_EXPORT_DLL __attribute__((visibility("default")))
76 #else
77 #define MYGUI_EXPORT
78 #define MYGUI_EXPORT_DLL
79 #endif
80 #
81#endif
82
83#ifndef NDEBUG
84 #define MYGUI_DEBUG_MODE 1
85#else
86 #define MYGUI_DEBUG_MODE 0
87#endif
88
89#endif // MYGUI_PLATFORM_H_