]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/build.h
wxCocoa: Added NSScrollView definition
[wxWidgets.git] / include / wx / build.h
index 58e2a0dd8461dc12b4bf683bc891d8eca4b1eb57..3e7ea2219ac61b8d578e600e71ce7faa28acfba3 100644 (file)
@@ -1,12 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Name:        wx/build.h
-// Purpose:     wxBuildOptions class declaration
-// Author:      Vadim Zeitlin
+// Purpose:     Runtime build options checking
+// Author:      Vadim Zeitlin, Vaclav Slavik
 // Modified by:
 // Created:     07.05.02
 // RCS-ID:      $Id$
 // Copyright:   (c) 2002 Vadim Zeitlin <vadim@wxwindows.org>
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_BUILD_H_
 #include "wx/version.h"
 
 // ----------------------------------------------------------------------------
-// wxBuildOptions
+// WX_BUILD_OPTIONS_SIGNATURE
 // ----------------------------------------------------------------------------
 
-class wxBuildOptions
-{
-public:
-    // the ctor must be inline to get the compilation settings of the code
-    // which included this header
-    wxBuildOptions()
-    {
-        // debug/release
+#define __WX_BO_STRINGIZE(x)   __WX_BO_STRINGIZE0(x)
+#define __WX_BO_STRINGIZE0(x)  #x
+
+#if (wxMINOR_VERSION % 2) == 0
+    #define __WX_BO_VERSION(x,y,z) \
+        __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y)
+#else
+    #define __WX_BO_VERSION(x,y,z) \
+        __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z)
+#endif
+
 #ifdef __WXDEBUG__
-        m_isDebug = TRUE;
+    #define __WX_BO_DEBUG "debug"
+#else
+    #define __WX_BO_DEBUG "no debug"
+#endif
+
+#if wxUSE_UNICODE
+    #define __WX_BO_UNICODE "Unicode"
 #else
-        m_isDebug = FALSE;
+    #define __WX_BO_UNICODE "ANSI"
 #endif
 
-        // version: we don't test the micro version as hopefully changes
-        // between 2 micro versions don't result in fatal compatibility
-        // problems
-        m_verMaj = wxMAJOR_VERSION;
-        m_verMin = wxMINOR_VERSION;
-    }
+// GCC and Intel C++ share same C++ ABI, check if compiler versions are
+// compatible:
+#if (defined(__GNUG__) || defined(__INTEL_COMPILER) && \
+     defined(__GXX_ABI_VERSION))
+    #define __WX_BO_COMPILER \
+            ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION)
+#else
+    #define __WX_BO_COMPILER
+#endif
+        
+// This macro is passed as argument to wxConsoleApp::CheckBuildOptions()
+#define WX_BUILD_OPTIONS_SIGNATURE \
+    __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \
+    " (" __WX_BO_DEBUG "," __WX_BO_UNICODE __WX_BO_COMPILER ")"
 
-private:
-    // the version
-    int m_verMaj,
-        m_verMin;
 
-    // compiled with __WXDEBUG__?
-    bool m_isDebug;
 
-    // actually only CheckBuildOptions() should be our friend but well...
-    friend class wxAppBase;
-};
+// Use this macro to check build options. Adding it to a file in DLL will
+// ensure that the DLL checks build options in same way IMPLEMENT_APP() does.
+#define WX_CHECK_BUILD_OPTIONS(libName)                                 \
+    static bool wxCheckBuildOptions()                                   \
+    {                                                                   \
+        wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE,     \
+                                        libName);                       \
+        return true;                                                    \
+    };                                                                  \
+    static bool gs_buildOptionsCheck = wxCheckBuildOptions();
 
 #endif // _WX_BUILD_H_
-