]>
Commit | Line | Data |
---|---|---|
090a6d7a VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/build.h | |
2a7c7605 VS |
3 | // Purpose: Runtime build options checking |
4 | // Author: Vadim Zeitlin, Vaclav Slavik | |
090a6d7a VZ |
5 | // Modified by: |
6 | // Created: 07.05.02 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwindows.org> | |
371a5b4e | 9 | // Licence: wxWindows licence |
090a6d7a VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_BUILD_H_ | |
13 | #define _WX_BUILD_H_ | |
14 | ||
15 | #include "wx/version.h" | |
16 | ||
17 | // ---------------------------------------------------------------------------- | |
2a7c7605 | 18 | // WX_BUILD_OPTIONS_SIGNATURE |
090a6d7a VZ |
19 | // ---------------------------------------------------------------------------- |
20 | ||
f48eebbc VS |
21 | #define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x) |
22 | #define __WX_BO_STRINGIZE0(x) #x | |
2a7c7605 VS |
23 | |
24 | #if (wxMINOR_VERSION % 2) == 0 | |
25 | #define __WX_BO_VERSION(x,y,z) \ | |
26 | __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) | |
27 | #else | |
28 | #define __WX_BO_VERSION(x,y,z) \ | |
29 | __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z) | |
30 | #endif | |
31 | ||
090a6d7a | 32 | #ifdef __WXDEBUG__ |
2a7c7605 | 33 | #define __WX_BO_DEBUG "debug" |
090a6d7a | 34 | #else |
2a7c7605 | 35 | #define __WX_BO_DEBUG "no debug" |
090a6d7a VZ |
36 | #endif |
37 | ||
2a7c7605 VS |
38 | #if wxUSE_UNICODE |
39 | #define __WX_BO_UNICODE "Unicode" | |
40 | #else | |
41 | #define __WX_BO_UNICODE "ANSI" | |
42 | #endif | |
f48eebbc VS |
43 | |
44 | // GCC and Intel C++ share same C++ ABI, check if compiler versions are | |
45 | // compatible: | |
46 | #if (defined(__GNUG__) || defined(__INTEL_COMPILER) && \ | |
47 | defined(__GXX_ABI_VERSION)) | |
48 | #define __WX_BO_COMPILER \ | |
49 | ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION) | |
50 | #else | |
51 | #define __WX_BO_COMPILER | |
52 | #endif | |
e1a4f817 VS |
53 | |
54 | // WXWIN_COMPATIBILITY macros affect presence of virtual functions | |
e1a4f817 VS |
55 | #if WXWIN_COMPATIBILITY_2_2 |
56 | #define __WX_BO_WXWIN_COMPAT_2_2 ",compatible with 2.2" | |
57 | #else | |
58 | #define __WX_BO_WXWIN_COMPAT_2_2 | |
59 | #endif | |
60 | #if WXWIN_COMPATIBILITY_2_4 | |
61 | #define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4" | |
62 | #else | |
63 | #define __WX_BO_WXWIN_COMPAT_2_4 | |
64 | #endif | |
65 | ||
f48eebbc | 66 | |
2a7c7605 VS |
67 | // This macro is passed as argument to wxConsoleApp::CheckBuildOptions() |
68 | #define WX_BUILD_OPTIONS_SIGNATURE \ | |
69 | __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ | |
e1a4f817 VS |
70 | " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \ |
71 | __WX_BO_COMPILER \ | |
e1a4f817 VS |
72 | __WX_BO_WXWIN_COMPAT_2_2 __WX_BO_WXWIN_COMPAT_2_4 \ |
73 | ")" | |
090a6d7a | 74 | |
090a6d7a | 75 | |
f75d7781 VS |
76 | // ---------------------------------------------------------------------------- |
77 | // WX_CHECK_BUILD_OPTIONS | |
78 | // ---------------------------------------------------------------------------- | |
090a6d7a | 79 | |
2a7c7605 VS |
80 | // Use this macro to check build options. Adding it to a file in DLL will |
81 | // ensure that the DLL checks build options in same way IMPLEMENT_APP() does. | |
82 | #define WX_CHECK_BUILD_OPTIONS(libName) \ | |
83 | static bool wxCheckBuildOptions() \ | |
84 | { \ | |
85 | wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ | |
86 | libName); \ | |
87 | return true; \ | |
88 | }; \ | |
89 | static bool gs_buildOptionsCheck = wxCheckBuildOptions(); | |
090a6d7a | 90 | |
f75d7781 VS |
91 | |
92 | #if WXWIN_COMPATIBILITY_2_4 | |
93 | ||
94 | // ---------------------------------------------------------------------------- | |
95 | // wxBuildOptions | |
96 | // ---------------------------------------------------------------------------- | |
97 | ||
98 | // NB: Don't use this class in new code, it relies on the ctor being always | |
99 | // inlined. WX_BUILD_OPTIONS_SIGNATURE always works. | |
100 | class wxBuildOptions | |
101 | { | |
102 | public: | |
103 | // the ctor must be inline to get the compilation settings of the code | |
104 | // which included this header | |
105 | wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE) {} | |
106 | ||
107 | private: | |
108 | const char *m_signature; | |
109 | ||
110 | // actually only CheckBuildOptions() should be our friend but well... | |
111 | friend class wxAppConsole; | |
112 | }; | |
113 | ||
114 | #endif // WXWIN_COMPATIBILITY_2_4 | |
115 | ||
090a6d7a | 116 | #endif // _WX_BUILD_H_ |