• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

MyGUI_Platform.h

Go to the documentation of this file.
00001 
00008 /*
00009     This file is part of MyGUI.
00010     
00011     MyGUI is free software: you can redistribute it and/or modify
00012     it under the terms of the GNU Lesser General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015     
00016     MyGUI is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU Lesser General Public License for more details.
00020     
00021     You should have received a copy of the GNU Lesser General Public License
00022     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #ifndef __MYGUI_PLATFORM_H__
00026 #define __MYGUI_PLATFORM_H__
00027 
00028 // Definnition of platforms
00029 #define MYGUI_PLATFORM_WIN32        1
00030 #define MYGUI_PLATFORM_LINUX        2
00031 #define MYGUI_PLATFORM_APPLE        3
00032 
00033 // Definition of compilers
00034 #define MYGUI_COMPILER_MSVC 1
00035 #define MYGUI_COMPILER_GNUC 2
00036 
00037 
00038 // Find platform
00039 #if defined (__WIN32__) || defined (_WIN32)
00040 #   define MYGUI_PLATFORM MYGUI_PLATFORM_WIN32
00041 #elif defined (__APPLE_CC__)
00042 #   define MYGUI_PLATFORM MYGUI_PLATFORM_APPLE
00043 #else
00044 #   define MYGUI_PLATFORM MYGUI_PLATFORM_LINUX
00045 #endif
00046 
00047 // Find compiler
00048 #if defined( _MSC_VER )
00049 #   define MYGUI_COMPILER MYGUI_COMPILER_MSVC
00050 #   define MYGUI_COMP_VER _MSC_VER
00051 
00052 #elif defined( __GNUC__ )
00053 #   define MYGUI_COMPILER MYGUI_COMPILER_GNUC
00054 #   define MYGUI_COMP_VER (((__GNUC__)*100) + \
00055         (__GNUC_MINOR__*10) + \
00056         __GNUC_PATCHLEVEL__)
00057 #else
00058 #   pragma error "Unknown compiler! Stop building!!!"
00059 #endif
00060 
00061 // See if we can use __forceinline or if we need to use __inline instead
00062 #if MYGUI_COMPILER == MYGUI_COMPILER_MSVC
00063 #   if MYGUI_COMP_VER >= 1200
00064 #       define MYGUI_FORCEINLINE __forceinline
00065 #   endif
00066 #elif defined(__MINGW32__)
00067 #   if !defined(MYGUI_FORCEINLINE)
00068 #       define MYGUI_FORCEINLINE __inline
00069 #   endif
00070 #else
00071 #   define MYGUI_FORCEINLINE __inline
00072 #endif
00073 
00074 
00075 // Windows settings
00076 #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
00077 #
00078 #   if defined( MYGUI_BUILD )
00079 #     define MYGUI_EXPORT __declspec( dllexport )
00080 # else
00081 #     if defined( __MINGW32__ )
00082 #          define MYGUI_EXPORT
00083 #     else
00084 #         define MYGUI_EXPORT __declspec( dllimport )
00085 #     endif
00086 # endif
00087 #
00088 #   if defined( MYGUI_BUILD_DLL )
00089 #     define MYGUI_EXPORT_DLL __declspec( dllexport )
00090 # else
00091 #     if defined( __MINGW32__ )
00092 #          define MYGUI_EXPORT_DLL
00093 #     else
00094 #         define MYGUI_EXPORT_DLL __declspec( dllimport )
00095 #     endif
00096 # endif
00097 #
00098 #// Win32 compilers use _DEBUG for specifying debug builds.
00099 # ifdef _DEBUG
00100 #     define MYGUI_DEBUG_MODE 1
00101 # else
00102 #     define MYGUI_DEBUG_MODE 0
00103 # endif
00104 #endif
00105 
00106 
00107 // Linux/Apple Settings
00108 #if MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX || MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
00109 
00110 // Add -fvisibility=hidden to compiler options. With -fvisibility=hidden, you are telling
00111 // GCC that every declaration not explicitly marked with a visibility attribute (MYGUI_EXPORT)
00112 // has a hidden visibility (like in windows).
00113 #   if __GNUC__ >= 4
00114 #       define MYGUI_EXPORT  __attribute__ ((visibility("default")))
00115 #   else
00116 #       define MYGUI_EXPORT
00117 #   endif
00118 
00119 #   if __GNUC__ >= 4
00120 #       define MYGUI_EXPORT_DLL  __attribute__ ((visibility("default")))
00121 #   else
00122 #       define MYGUI_EXPORT_DLL
00123 #   endif
00124 
00125 // A quick define to overcome different names for the same function
00126 #   define stricmp strcasecmp
00127 
00128 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
00129 // specifying a debug build.
00130 // (??? this is wrong, on Linux debug builds aren't marked in any way unless
00131 // you mark it yourself any way you like it -- zap ???)
00132 #   ifdef DEBUG
00133 #       define MYGUI_DEBUG_MODE 1
00134 #   else
00135 #       define MYGUI_DEBUG_MODE 0
00136 #   endif
00137 
00138 #if MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
00139     #define MYGUI_PLATFORM_LIB "MYGUIPlatform.bundle"
00140 #else
00141     //MYGUI_PLATFORM_LINUX
00142     #define MYGUI_PLATFORM_LIB "libMYGUIPlatform.so"
00143 #endif
00144 
00145 #endif
00146 
00147 
00148 #endif // __MYGUI_PLATFORM_H__

Generated on Sun Jan 30 2011 for MyGUI by  doxygen 1.7.1