]> git.saurik.com Git - wxWidgets.git/blame - include/wx/build.h
added template wxScopedArray<> too
[wxWidgets.git] / include / wx / build.h
CommitLineData
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
7a47e45e
VS
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
090a6d7a 30// ----------------------------------------------------------------------------
2a7c7605 31// WX_BUILD_OPTIONS_SIGNATURE
090a6d7a
VZ
32// ----------------------------------------------------------------------------
33
f48eebbc
VS
34#define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x)
35#define __WX_BO_STRINGIZE0(x) #x
2a7c7605
VS
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
090a6d7a 45#ifdef __WXDEBUG__
2a7c7605 46 #define __WX_BO_DEBUG "debug"
090a6d7a 47#else
2a7c7605 48 #define __WX_BO_DEBUG "no debug"
090a6d7a
VZ
49#endif
50
a74deb88
VZ
51#if wxUSE_UNICODE_UTF8
52 #define __WX_BO_UNICODE "UTF-8"
53#elif wxUSE_UNICODE_WCHAR
54 #define __WX_BO_UNICODE "wchar_t"
2a7c7605
VS
55#else
56 #define __WX_BO_UNICODE "ANSI"
57#endif
f48eebbc 58
eaee975a
VS
59// GCC and Intel C++ share same C++ ABI (and possibly others in the future),
60// check if compiler versions are compatible:
61#if defined(__GXX_ABI_VERSION)
f48eebbc
VS
62 #define __WX_BO_COMPILER \
63 ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION)
eaee975a
VS
64#elif defined(__INTEL_COMPILER)
65 #define __WX_BO_COMPILER ",Intel C++"
66#elif defined(__GNUG__)
67 #define __WX_BO_COMPILER ",GCC " \
68 __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__)
69#elif defined(__VISUALC__)
f86f607c 70 #define __WX_BO_COMPILER ",Visual C++ " __WX_BO_STRINGIZE(_MSC_VER)
eaee975a 71#elif defined(__BORLANDC__)
981a6271 72 #define __WX_BO_COMPILER ",Borland C++"
eaee975a 73#elif defined(__DIGITALMARS__)
981a6271 74 #define __WX_BO_COMPILER ",DigitalMars"
eaee975a
VS
75#elif defined(__WATCOMC__)
76 #define __WX_BO_COMPILER ",Watcom C++"
f48eebbc
VS
77#else
78 #define __WX_BO_COMPILER
79#endif
e1a4f817
VS
80
81// WXWIN_COMPATIBILITY macros affect presence of virtual functions
dee1a63f
MB
82#if WXWIN_COMPATIBILITY_2_6
83 #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6"
84#else
85 #define __WX_BO_WXWIN_COMPAT_2_6
86#endif
c1dc9f83
VZ
87#if WXWIN_COMPATIBILITY_2_8
88 #define __WX_BO_WXWIN_COMPAT_2_8 ",compatible with 2.8"
89#else
90 #define __WX_BO_WXWIN_COMPAT_2_8
91#endif
e1a4f817 92
2a5f8668
VS
93// deriving wxWin containers from STL ones changes them completely:
94#if wxUSE_STL
95 #define __WX_BO_STL ",STL containers"
96#else
97 #define __WX_BO_STL ",wx containers"
98#endif
c9d59ee7 99
2a7c7605
VS
100// This macro is passed as argument to wxConsoleApp::CheckBuildOptions()
101#define WX_BUILD_OPTIONS_SIGNATURE \
102 __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \
e1a4f817
VS
103 " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \
104 __WX_BO_COMPILER \
2a5f8668 105 __WX_BO_STL \
c1dc9f83 106 __WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 \
e1a4f817 107 ")"
090a6d7a 108
090a6d7a 109
f75d7781
VS
110// ----------------------------------------------------------------------------
111// WX_CHECK_BUILD_OPTIONS
112// ----------------------------------------------------------------------------
090a6d7a 113
2a7c7605
VS
114// Use this macro to check build options. Adding it to a file in DLL will
115// ensure that the DLL checks build options in same way IMPLEMENT_APP() does.
116#define WX_CHECK_BUILD_OPTIONS(libName) \
17a1ebd1 117 static struct wxBuildOptionsChecker \
2a7c7605 118 { \
17a1ebd1
VZ
119 wxBuildOptionsChecker() \
120 { \
121 wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
122 libName); \
123 } \
124 } gs_buildOptionsCheck;
090a6d7a 125
f75d7781 126
090a6d7a 127#endif // _WX_BUILD_H_