]>
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$ | |
77ffb593 | 8 | // Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org> |
65571936 | 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 | 43 | |
eaee975a VS |
44 | // GCC and Intel C++ share same C++ ABI (and possibly others in the future), |
45 | // check if compiler versions are compatible: | |
46 | #if defined(__GXX_ABI_VERSION) | |
f48eebbc VS |
47 | #define __WX_BO_COMPILER \ |
48 | ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION) | |
eaee975a VS |
49 | #elif defined(__INTEL_COMPILER) |
50 | #define __WX_BO_COMPILER ",Intel C++" | |
51 | #elif defined(__GNUG__) | |
52 | #define __WX_BO_COMPILER ",GCC " \ | |
53 | __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__) | |
54 | #elif defined(__VISUALC__) | |
55 | #define __WX_BO_COMPILER ",Visual C++" | |
56 | #elif defined(__BORLANDC__) | |
340e9738 WS |
57 | |
58 | #if __BORLANDC__ >= 0x600 /* BCCX */ | |
59 | #define __WX_BO_COMPILER_VER " 6.0" | |
60 | #elif __BORLANDC__ >= 0x570 /* Kylix */ | |
61 | #define __WX_BO_COMPILER_VER " 5.7" | |
62 | #elif __BORLANDC__ >= 0x560 /* BCB++ 6 */ | |
63 | #define __WX_BO_COMPILER_VER " 5.6" | |
64 | #elif __BORLANDC__ >= 0x550 /* BCB++ 5, free command line */ | |
65 | #define __WX_BO_COMPILER_VER " 5.5" | |
66 | #elif __BORLANDC__ >= 0x520 /* BCB++ 1-4 */ | |
67 | #define __WX_BO_COMPILER_VER " 5.02" | |
68 | #elif __BORLANDC__ >= 0x500 /* BC++ 5 */ | |
69 | #define __WX_BO_COMPILER_VER " 5.0" | |
70 | #elif __BORLANDC__ >= 0x452 /* BC++ 4 */ | |
71 | #define __WX_BO_COMPILER_VER " 4.0" | |
72 | #elif __BORLANDC__ >= 0x410 /* BC++ 3.1 */ | |
73 | #define __WX_BO_COMPILER_VER " 3.1" | |
74 | #elif __BORLANDC__ >= 0x400 /* BC++ 3.0 */ | |
75 | #define __WX_BO_COMPILER_VER " 3.0" | |
76 | #elif __BORLANDC__ >= 0x200 /* BC++ 2.0 */ | |
77 | #define __WX_BO_COMPILER_VER " 2.0" | |
78 | #else | |
79 | #define __WX_BO_COMPILER_VER | |
80 | #endif | |
81 | ||
82 | #define __WX_BO_COMPILER ",Borland C++" __WX_BO_COMPILER_VER | |
83 | ||
eaee975a | 84 | #elif defined(__DIGITALMARS__) |
340e9738 WS |
85 | |
86 | #if defined(__DMC_VERSION_STRING__) | |
87 | #define __WX_BO_COMPILER "," __DMC_VERSION_STRING__ | |
88 | #else | |
89 | #define __WX_BO_COMPILER ",DigitalMars" | |
90 | #endif | |
91 | ||
eaee975a VS |
92 | #elif defined(__WATCOMC__) |
93 | #define __WX_BO_COMPILER ",Watcom C++" | |
f48eebbc VS |
94 | #else |
95 | #define __WX_BO_COMPILER | |
96 | #endif | |
e1a4f817 VS |
97 | |
98 | // WXWIN_COMPATIBILITY macros affect presence of virtual functions | |
e1a4f817 VS |
99 | #if WXWIN_COMPATIBILITY_2_2 |
100 | #define __WX_BO_WXWIN_COMPAT_2_2 ",compatible with 2.2" | |
101 | #else | |
102 | #define __WX_BO_WXWIN_COMPAT_2_2 | |
103 | #endif | |
104 | #if WXWIN_COMPATIBILITY_2_4 | |
105 | #define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4" | |
106 | #else | |
107 | #define __WX_BO_WXWIN_COMPAT_2_4 | |
108 | #endif | |
109 | ||
2a5f8668 VS |
110 | // deriving wxWin containers from STL ones changes them completely: |
111 | #if wxUSE_STL | |
112 | #define __WX_BO_STL ",STL containers" | |
113 | #else | |
114 | #define __WX_BO_STL ",wx containers" | |
115 | #endif | |
116 | ||
2a7c7605 VS |
117 | // This macro is passed as argument to wxConsoleApp::CheckBuildOptions() |
118 | #define WX_BUILD_OPTIONS_SIGNATURE \ | |
119 | __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ | |
e1a4f817 VS |
120 | " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \ |
121 | __WX_BO_COMPILER \ | |
2a5f8668 | 122 | __WX_BO_STL \ |
e1a4f817 VS |
123 | __WX_BO_WXWIN_COMPAT_2_2 __WX_BO_WXWIN_COMPAT_2_4 \ |
124 | ")" | |
090a6d7a | 125 | |
090a6d7a | 126 | |
f75d7781 VS |
127 | // ---------------------------------------------------------------------------- |
128 | // WX_CHECK_BUILD_OPTIONS | |
129 | // ---------------------------------------------------------------------------- | |
090a6d7a | 130 | |
2a7c7605 VS |
131 | // Use this macro to check build options. Adding it to a file in DLL will |
132 | // ensure that the DLL checks build options in same way IMPLEMENT_APP() does. | |
133 | #define WX_CHECK_BUILD_OPTIONS(libName) \ | |
134 | static bool wxCheckBuildOptions() \ | |
135 | { \ | |
136 | wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ | |
137 | libName); \ | |
138 | return true; \ | |
139 | }; \ | |
140 | static bool gs_buildOptionsCheck = wxCheckBuildOptions(); | |
090a6d7a | 141 | |
f75d7781 VS |
142 | |
143 | #if WXWIN_COMPATIBILITY_2_4 | |
144 | ||
145 | // ---------------------------------------------------------------------------- | |
146 | // wxBuildOptions | |
147 | // ---------------------------------------------------------------------------- | |
148 | ||
149 | // NB: Don't use this class in new code, it relies on the ctor being always | |
150 | // inlined. WX_BUILD_OPTIONS_SIGNATURE always works. | |
151 | class wxBuildOptions | |
152 | { | |
153 | public: | |
154 | // the ctor must be inline to get the compilation settings of the code | |
155 | // which included this header | |
156 | wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE) {} | |
157 | ||
158 | private: | |
159 | const char *m_signature; | |
160 | ||
161 | // actually only CheckBuildOptions() should be our friend but well... | |
162 | friend class wxAppConsole; | |
163 | }; | |
164 | ||
165 | #endif // WXWIN_COMPATIBILITY_2_4 | |
166 | ||
090a6d7a | 167 | #endif // _WX_BUILD_H_ |