]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/build.h
don't define WINVER as 0x0400 in configure, it's defined in the headers as 0x0600...
[wxWidgets.git] / include / wx / build.h
... / ...
CommitLineData
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 buildm, 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#ifdef __WXDEBUG__
46 #define __WX_BO_DEBUG "debug"
47#else
48 #define __WX_BO_DEBUG "no debug"
49#endif
50
51#if wxUSE_UNICODE
52 #define __WX_BO_UNICODE "Unicode"
53#else
54 #define __WX_BO_UNICODE "ANSI"
55#endif
56
57// GCC and Intel C++ share same C++ ABI (and possibly others in the future),
58// check if compiler versions are compatible:
59#if defined(__GXX_ABI_VERSION)
60 #define __WX_BO_COMPILER \
61 ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION)
62#elif defined(__INTEL_COMPILER)
63 #define __WX_BO_COMPILER ",Intel C++"
64#elif defined(__GNUG__)
65 #define __WX_BO_COMPILER ",GCC " \
66 __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__)
67#elif defined(__VISUALC__)
68 #define __WX_BO_COMPILER ",Visual C++"
69#elif defined(__BORLANDC__)
70 #define __WX_BO_COMPILER ",Borland C++"
71#elif defined(__DIGITALMARS__)
72 #define __WX_BO_COMPILER ",DigitalMars"
73#elif defined(__WATCOMC__)
74 #define __WX_BO_COMPILER ",Watcom C++"
75#else
76 #define __WX_BO_COMPILER
77#endif
78
79// WXWIN_COMPATIBILITY macros affect presence of virtual functions
80#if WXWIN_COMPATIBILITY_2_4
81 #define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4"
82#else
83 #define __WX_BO_WXWIN_COMPAT_2_4
84#endif
85#if WXWIN_COMPATIBILITY_2_6
86 #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6"
87#else
88 #define __WX_BO_WXWIN_COMPAT_2_6
89#endif
90
91// deriving wxWin containers from STL ones changes them completely:
92#if wxUSE_STL
93 #define __WX_BO_STL ",STL containers"
94#else
95 #define __WX_BO_STL ",wx containers"
96#endif
97
98// This macro is passed as argument to wxConsoleApp::CheckBuildOptions()
99#define WX_BUILD_OPTIONS_SIGNATURE \
100 __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \
101 " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \
102 __WX_BO_COMPILER \
103 __WX_BO_STL \
104 __WX_BO_WXWIN_COMPAT_2_4 __WX_BO_WXWIN_COMPAT_2_6 \
105 ")"
106
107
108// ----------------------------------------------------------------------------
109// WX_CHECK_BUILD_OPTIONS
110// ----------------------------------------------------------------------------
111
112// Use this macro to check build options. Adding it to a file in DLL will
113// ensure that the DLL checks build options in same way IMPLEMENT_APP() does.
114#define WX_CHECK_BUILD_OPTIONS(libName) \
115 static struct wxBuildOptionsChecker \
116 { \
117 wxBuildOptionsChecker() \
118 { \
119 wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
120 libName); \
121 } \
122 } gs_buildOptionsCheck;
123
124
125#if WXWIN_COMPATIBILITY_2_4
126
127// ----------------------------------------------------------------------------
128// wxBuildOptions
129// ----------------------------------------------------------------------------
130
131// NB: Don't use this class in new code, it relies on the ctor being always
132// inlined. WX_BUILD_OPTIONS_SIGNATURE always works.
133class wxBuildOptions
134{
135public:
136 // the ctor must be inline to get the compilation settings of the code
137 // which included this header
138 wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE) {}
139
140private:
141 const char *m_signature;
142
143 // actually only CheckBuildOptions() should be our friend but well...
144 friend class wxAppConsole;
145};
146
147#endif // WXWIN_COMPATIBILITY_2_4
148
149#endif // _WX_BUILD_H_