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