MyGUI
3.2.1
|
00001 /* 00002 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 00003 * Distributed under the MIT License 00004 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 00005 */ 00006 00007 #ifndef __MYGUI_PLATFORM_H__ 00008 #define __MYGUI_PLATFORM_H__ 00009 00010 // Definition of platforms 00011 #define MYGUI_PLATFORM_WIN32 1 00012 #define MYGUI_PLATFORM_LINUX 2 00013 #define MYGUI_PLATFORM_APPLE 3 00014 00015 // Definition of compilers 00016 #define MYGUI_COMPILER_MSVC 1 00017 #define MYGUI_COMPILER_GNUC 2 00018 00019 00020 // Find platform 00021 #if defined (__WIN32__) || defined (_WIN32) 00022 # define MYGUI_PLATFORM MYGUI_PLATFORM_WIN32 00023 #elif defined (__APPLE_CC__) 00024 # define MYGUI_PLATFORM MYGUI_PLATFORM_APPLE 00025 #else 00026 # define MYGUI_PLATFORM MYGUI_PLATFORM_LINUX 00027 #endif 00028 00029 // Find compiler 00030 #if defined( _MSC_VER ) 00031 # define MYGUI_COMPILER MYGUI_COMPILER_MSVC 00032 # define MYGUI_COMP_VER _MSC_VER 00033 00034 #elif defined( __GNUC__ ) 00035 # define MYGUI_COMPILER MYGUI_COMPILER_GNUC 00036 # define MYGUI_COMP_VER (((__GNUC__)*100) + \ 00037 (__GNUC_MINOR__*10) + \ 00038 __GNUC_PATCHLEVEL__) 00039 #else 00040 # pragma error "Unknown compiler! Stop building!!!" 00041 #endif 00042 00043 // See if we can use __forceinline or if we need to use __inline instead 00044 #if MYGUI_COMPILER == MYGUI_COMPILER_MSVC 00045 # if MYGUI_COMP_VER >= 1200 00046 # define MYGUI_FORCEINLINE __forceinline 00047 # endif 00048 #elif defined(__MINGW32__) 00049 # if !defined(MYGUI_FORCEINLINE) 00050 # define MYGUI_FORCEINLINE __inline 00051 # endif 00052 #else 00053 # define MYGUI_FORCEINLINE __inline 00054 #endif 00055 00056 00057 // Windows settings 00058 #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 00059 # 00060 # if defined( MYGUI_STATIC ) 00061 # define MYGUI_EXPORT 00062 # elif defined( MYGUI_BUILD ) 00063 # define MYGUI_EXPORT __declspec( dllexport ) 00064 # else 00065 # if defined( __MINGW32__ ) 00066 # define MYGUI_EXPORT 00067 # else 00068 # define MYGUI_EXPORT __declspec( dllimport ) 00069 # endif 00070 # endif 00071 # 00072 # if defined( MYGUI_STATIC ) 00073 # define MYGUI_EXPORT_DLL 00074 # elif defined( MYGUI_BUILD_DLL ) 00075 # define MYGUI_EXPORT_DLL __declspec( dllexport ) 00076 # else 00077 # if defined( __MINGW32__ ) 00078 # define MYGUI_EXPORT_DLL 00079 # else 00080 # define MYGUI_EXPORT_DLL __declspec( dllimport ) 00081 # endif 00082 # endif 00083 # 00084 #// Win32 compilers use _DEBUG for specifying debug builds. 00085 # ifdef _DEBUG 00086 # define MYGUI_DEBUG_MODE 1 00087 # else 00088 # define MYGUI_DEBUG_MODE 0 00089 # endif 00090 #endif 00091 00092 00093 // Linux/Apple Settings 00094 #if MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX || MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE 00095 # 00096 // Add -fvisibility=hidden to compiler options. With -fvisibility=hidden, you are telling 00097 // GCC that every declaration not explicitly marked with a visibility attribute (MYGUI_EXPORT) 00098 // has a hidden visibility (like in windows). 00099 # if __GNUC__ >= 4 00100 # define MYGUI_EXPORT __attribute__ ((visibility("default"))) 00101 # else 00102 # define MYGUI_EXPORT 00103 # endif 00104 # 00105 # if __GNUC__ >= 4 00106 # define MYGUI_EXPORT_DLL __attribute__ ((visibility("default"))) 00107 # else 00108 # define MYGUI_EXPORT_DLL 00109 # endif 00110 # 00111 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when 00112 // specifying a debug build. 00113 // (??? this is wrong, on Linux debug builds aren't marked in any way unless 00114 // you mark it yourself any way you like it -- zap ???) 00115 # ifdef DEBUG 00116 # define MYGUI_DEBUG_MODE 1 00117 # else 00118 # define MYGUI_DEBUG_MODE 0 00119 # endif 00120 00121 # if MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE 00122 # define MYGUI_PLATFORM_LIB "MYGUIPlatform.bundle" 00123 # else // if MYGUI_PLATFORM_LINUX 00124 # define MYGUI_PLATFORM_LIB "libMYGUIPlatform.so" 00125 # endif 00126 00127 #endif 00128 00129 00130 #endif // __MYGUI_PLATFORM_H__