]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/build.h | |
3 | // Purpose: Runtime build options checking | |
4 | // Author: Vadim Zeitlin, Vaclav Slavik | |
5 | // Modified by: | |
6 | // Created: 07.05.02 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org> | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_BUILD_H_ | |
13 | #define _WX_BUILD_H_ | |
14 | ||
15 | #include "wx/version.h" | |
16 | ||
17 | // NB: This file contains macros for checking binary compatibility of libraries | |
18 | // in multilib builds, plugins and user components. | |
19 | // The WX_BUILD_OPTIONS_SIGNATURE macro expands into string that should | |
20 | // uniquely identify binary compatible builds: i.e. if two builds of the | |
21 | // library are binary compatible, their signature string should be the | |
22 | // same; if two builds are binary incompatible, their signatures should | |
23 | // be different. | |
24 | // | |
25 | // Therefore, wxUSE_XXX flags that affect binary compatibility (vtables, | |
26 | // function signatures) should be accounted for here. So should compilers | |
27 | // and compiler versions (but note that binary compatible compiler versions | |
28 | // such as gcc-2.95.2 and gcc-2.95.3 should have same signature!). | |
29 | ||
30 | // ---------------------------------------------------------------------------- | |
31 | // WX_BUILD_OPTIONS_SIGNATURE | |
32 | // ---------------------------------------------------------------------------- | |
33 | ||
34 | #define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x) | |
35 | #define __WX_BO_STRINGIZE0(x) #x | |
36 | ||
37 | #if (wxMINOR_VERSION % 2) == 0 | |
38 | #define __WX_BO_VERSION(x,y,z) \ | |
39 | __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) | |
40 | #else | |
41 | #define __WX_BO_VERSION(x,y,z) \ | |
42 | __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z) | |
43 | #endif | |
44 | ||
45 | #if wxUSE_UNICODE_UTF8 | |
46 | #define __WX_BO_UNICODE "UTF-8" | |
47 | #elif wxUSE_UNICODE_WCHAR | |
48 | #define __WX_BO_UNICODE "wchar_t" | |
49 | #else | |
50 | #define __WX_BO_UNICODE "ANSI" | |
51 | #endif | |
52 | ||
53 | // GCC and Intel C++ share same C++ ABI (and possibly others in the future), | |
54 | // check if compiler versions are compatible: | |
55 | #if defined(__GXX_ABI_VERSION) | |
56 | #define __WX_BO_COMPILER \ | |
57 | ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION) | |
58 | #elif defined(__INTEL_COMPILER) | |
59 | #define __WX_BO_COMPILER ",Intel C++" | |
60 | #elif defined(__GNUG__) | |
61 | #define __WX_BO_COMPILER ",GCC " \ | |
62 | __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__) | |
63 | #elif defined(__VISUALC__) | |
64 | #define __WX_BO_COMPILER ",Visual C++ " __WX_BO_STRINGIZE(_MSC_VER) | |
65 | #elif defined(__BORLANDC__) | |
66 | #define __WX_BO_COMPILER ",Borland C++" | |
67 | #elif defined(__DIGITALMARS__) | |
68 | #define __WX_BO_COMPILER ",DigitalMars" | |
69 | #elif defined(__WATCOMC__) | |
70 | #define __WX_BO_COMPILER ",Watcom C++" | |
71 | #else | |
72 | #define __WX_BO_COMPILER | |
73 | #endif | |
74 | ||
75 | // WXWIN_COMPATIBILITY macros affect presence of virtual functions | |
76 | #if WXWIN_COMPATIBILITY_2_6 | |
77 | #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6" | |
78 | #else | |
79 | #define __WX_BO_WXWIN_COMPAT_2_6 | |
80 | #endif | |
81 | #if WXWIN_COMPATIBILITY_2_8 | |
82 | #define __WX_BO_WXWIN_COMPAT_2_8 ",compatible with 2.8" | |
83 | #else | |
84 | #define __WX_BO_WXWIN_COMPAT_2_8 | |
85 | #endif | |
86 | ||
87 | // deriving wxWin containers from STL ones changes them completely: | |
88 | #if wxUSE_STL | |
89 | #define __WX_BO_STL ",STL containers" | |
90 | #else | |
91 | #define __WX_BO_STL ",wx containers" | |
92 | #endif | |
93 | ||
94 | // This macro is passed as argument to wxConsoleApp::CheckBuildOptions() | |
95 | #define WX_BUILD_OPTIONS_SIGNATURE \ | |
96 | __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ | |
97 | " (" __WX_BO_UNICODE \ | |
98 | __WX_BO_COMPILER \ | |
99 | __WX_BO_STL \ | |
100 | __WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 \ | |
101 | ")" | |
102 | ||
103 | ||
104 | // ---------------------------------------------------------------------------- | |
105 | // WX_CHECK_BUILD_OPTIONS | |
106 | // ---------------------------------------------------------------------------- | |
107 | ||
108 | // Use this macro to check build options. Adding it to a file in DLL will | |
109 | // ensure that the DLL checks build options in same way wxIMPLEMENT_APP() does. | |
110 | #define WX_CHECK_BUILD_OPTIONS(libName) \ | |
111 | static struct wxBuildOptionsChecker \ | |
112 | { \ | |
113 | wxBuildOptionsChecker() \ | |
114 | { \ | |
115 | wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ | |
116 | libName); \ | |
117 | } \ | |
118 | } gs_buildOptionsCheck; | |
119 | ||
120 | ||
121 | #endif // _WX_BUILD_H_ |