Allow building wxGTK under Windows with MSVC.
[wxWidgets.git] / include / msvc / wx / setup.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: msvc/wx/setup.h
3 // Purpose: wrapper around the real wx/setup.h for Visual C++
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 2004-12-12
7 // RCS-ID: $Id$
8 // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _MSC_VER
13 #error "This file should only be included when using Microsoft Visual C++"
14 #endif
15
16 // VC++ IDE predefines _DEBUG and _UNICODE for the new projects itself, but
17 // the other symbols (WXUSINGDLL, __WXUNIVERSAL__, ...) should be defined
18 // explicitly!
19
20 #include "wx/version.h"
21 #include "wx/cpp.h"
22
23 // notice that wxSUFFIX_DEBUG is a string but wxSUFFIX itself must be an
24 // identifier as string concatenation is not done inside #include where we
25 // need it
26 #ifdef _DEBUG
27 #define wxSUFFIX_DEBUG "d"
28 #ifdef _UNICODE
29 #define wxSUFFIX ud
30 #else // !_UNICODE
31 #define wxSUFFIX d
32 #endif // _UNICODE/!_UNICODE
33 #else
34 #define wxSUFFIX_DEBUG ""
35 #ifdef _UNICODE
36 #define wxSUFFIX u
37 #else // !_UNICODE
38 // don't define wxSUFFIX at all as preprocessor operations don't work
39 // with empty values so we need to check for this case specially below
40 #endif // _UNICODE/!_UNICODE
41 #endif
42
43 // compiler-specific prefix: by default it's always just "vc" for compatibility
44 // reasons but if you use multiple MSVC versions you probably build them with
45 // COMPILER_PREFIX=vcXX and in this case you may want to either predefine
46 // wxMSVC_VERSION as "XX" or define wxMSVC_VERSION_AUTO to use the appropriate
47 // version depending on the compiler used
48 #ifdef wxMSVC_VERSION
49 #define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION)
50 #elif defined(wxMSVC_VERSION_AUTO)
51 #if _MSC_VER == 1200
52 #define wxCOMPILER_PREFIX vc60
53 #elif _MSC_VER == 1300
54 #define wxCOMPILER_PREFIX vc70
55 #elif _MSC_VER == 1310
56 #define wxCOMPILER_PREFIX vc71
57 #elif _MSC_VER == 1400
58 #define wxCOMPILER_PREFIX vc80
59 #elif _MSC_VER == 1500
60 #define wxCOMPILER_PREFIX vc90
61 #elif _MSC_VER == 1600
62 #define wxCOMPILER_PREFIX vc100
63 #elif _MSC_VER == 1700
64 #define wxCOMPILER_PREFIX vc110
65 #else
66 #error "Unknown MSVC compiler version, please report to wx-dev."
67 #endif
68 #else
69 #define wxCOMPILER_PREFIX vc
70 #endif
71
72 // architecture-specific part: not used (again, for compatibility), for x86
73 #if defined(_M_X64)
74 #define wxARCH_SUFFIX _x64
75 #elif defined(_M_IA64)
76 #define wxARCH_SUFFIX _ia64
77 #else // assume _M_IX86
78 #define wxARCH_SUFFIX
79 #endif
80
81 #ifdef WXUSINGDLL
82 #define wxLIB_SUBDIR wxCONCAT3(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _dll)
83 #else // !DLL
84 #define wxLIB_SUBDIR wxCONCAT3(wxCOMPILER_PREFIX, wxARCH_SUFFIX, _lib)
85 #endif // DLL/!DLL
86
87 // The user can predefine a different prefix if not using the default MSW port
88 // with MSVC.
89 #ifndef wxTOOLKIT_PREFIX
90 #if defined(__WXGTK__)
91 #define wxTOOLKIT_PREFIX gtk2
92 #else
93 #define wxTOOLKIT_PREFIX msw
94 #endif
95 #endif // wxTOOLKIT_PREFIX
96
97 // the real setup.h header file we need is in the build-specific directory,
98 // construct the path to it
99 #ifdef wxSUFFIX
100 #define wxSETUPH_PATH \
101 wxCONCAT6(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, wxSUFFIX, /wx/setup.h)
102 #else // suffix is empty
103 #define wxSETUPH_PATH \
104 wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, /wx/setup.h)
105 #endif
106
107 #define wxSETUPH_PATH_STR wxSTRINGIZE(wxSETUPH_PATH)
108
109 #include wxSETUPH_PATH_STR
110
111
112 // the library names depend on the build, these macro builds the correct
113 // library name for the given base name
114 #ifdef wxSUFFIX
115 #define wxSUFFIX_STR wxSTRINGIZE(wxSUFFIX)
116 #else // suffix is empty
117 #define wxSUFFIX_STR ""
118 #endif
119 #define wxSHORT_VERSION_STRING \
120 wxSTRINGIZE(wxMAJOR_VERSION) wxSTRINGIZE(wxMINOR_VERSION)
121
122 #define wxWX_LIB_NAME(name, subname) \
123 "wx" name wxSHORT_VERSION_STRING wxSUFFIX_STR subname
124
125 #define wxBASE_LIB_NAME(name) wxWX_LIB_NAME("base", "_" name)
126 #define wxTOOLKIT_LIB_NAME(name) wxWX_LIB_NAME(wxSTRINGIZE(wxTOOLKIT_PREFIX), "_" name)
127
128 // This one is for 3rd party libraries: they don't have the version number
129 // in their names and usually exist in ANSI version only (except for regex)
130 //
131 // 3rd party libraries are also are not linked in when using DLLs as they're
132 // embedded inside our own DLLs and don't need to be linked with the user code.
133 #define wx3RD_PARTY_LIB_NAME(name) "wx" name wxSUFFIX_DEBUG
134
135 // special version for regex as it does have a Unicode version
136 #define wx3RD_PARTY_LIB_NAME_U(name) "wx" name wxSUFFIX_STR
137
138 #pragma comment(lib, wxWX_LIB_NAME("base", ""))
139
140 #ifndef wxNO_NET_LIB
141 #pragma comment(lib, wxBASE_LIB_NAME("net"))
142 #endif
143 #ifndef wxNO_XML_LIB
144 #pragma comment(lib, wxBASE_LIB_NAME("xml"))
145 #endif
146 #if wxUSE_REGEX && !defined(wxNO_REGEX_LIB) && !defined(WXUSINGDLL)
147 #pragma comment(lib, wx3RD_PARTY_LIB_NAME_U("regex"))
148 #endif
149
150 #if wxUSE_GUI
151 #if wxUSE_XML && !defined(wxNO_EXPAT_LIB) && !defined(WXUSINGDLL)
152 #pragma comment(lib, wx3RD_PARTY_LIB_NAME("expat"))
153 #endif
154 #if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) && !defined(WXUSINGDLL)
155 #pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg"))
156 #endif
157 #if wxUSE_LIBPNG && !defined(wxNO_PNG_LIB) && !defined(WXUSINGDLL)
158 #pragma comment(lib, wx3RD_PARTY_LIB_NAME("png"))
159 #endif
160 #if wxUSE_LIBTIFF && !defined(wxNO_TIFF_LIB) && !defined(WXUSINGDLL)
161 #pragma comment(lib, wx3RD_PARTY_LIB_NAME("tiff"))
162 #endif
163 #if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB) && !defined(WXUSINGDLL)
164 #pragma comment(lib, wx3RD_PARTY_LIB_NAME("zlib"))
165 #endif
166
167 #pragma comment(lib, wxTOOLKIT_LIB_NAME("core"))
168
169 #ifndef wxNO_ADV_LIB
170 #pragma comment(lib, wxTOOLKIT_LIB_NAME("adv"))
171 #endif
172
173 #ifndef wxNO_HTML_LIB
174 #pragma comment(lib, wxTOOLKIT_LIB_NAME("html"))
175 #endif
176 #if wxUSE_GLCANVAS && !defined(wxNO_GL_LIB)
177 #pragma comment(lib, wxTOOLKIT_LIB_NAME("gl"))
178 #endif
179 #if wxUSE_DEBUGREPORT && !defined(wxNO_QA_LIB)
180 #pragma comment(lib, wxTOOLKIT_LIB_NAME("qa"))
181 #endif
182 #if wxUSE_XRC && !defined(wxNO_XRC_LIB)
183 #pragma comment(lib, wxTOOLKIT_LIB_NAME("xrc"))
184 #endif
185 #if wxUSE_AUI && !defined(wxNO_AUI_LIB)
186 #pragma comment(lib, wxTOOLKIT_LIB_NAME("aui"))
187 #endif
188 #if wxUSE_PROPGRID && !defined(wxNO_PROPGRID_LIB)
189 #pragma comment(lib, wxTOOLKIT_LIB_NAME("propgrid"))
190 #endif
191 #if wxUSE_RIBBON && !defined(wxNO_RIBBON_LIB)
192 #pragma comment(lib, wxTOOLKIT_LIB_NAME("ribbon"))
193 #endif
194 #if wxUSE_RICHTEXT && !defined(wxNO_RICHTEXT_LIB)
195 #pragma comment(lib, wxTOOLKIT_LIB_NAME("richtext"))
196 #endif
197 #if wxUSE_MEDIACTRL && !defined(wxNO_MEDIA_LIB)
198 #pragma comment(lib, wxTOOLKIT_LIB_NAME("media"))
199 #endif
200 #if wxUSE_STC && !defined(wxNO_STC_LIB)
201 #pragma comment(lib, wxTOOLKIT_LIB_NAME("stc"))
202 #ifndef WXUSINGDLL
203 #pragma comment(lib, wx3RD_PARTY_LIB_NAME("scintilla"))
204 #endif
205 #endif
206 #if wxUSE_WEBVIEW && !defined(wxNO_WEBVIEW_LIB)
207 #pragma comment(lib, wxTOOLKIT_LIB_NAME("webview"))
208 #endif
209 #endif // wxUSE_GUI
210
211
212 #ifndef WXUSINGDLL
213 // Make sure all required system libraries are added to the linker too when
214 // using static libraries.
215 #pragma comment(lib, "kernel32")
216 #pragma comment(lib, "user32")
217 #pragma comment(lib, "gdi32")
218 #pragma comment(lib, "comdlg32")
219 #pragma comment(lib, "winspool")
220 #pragma comment(lib, "winmm")
221 #pragma comment(lib, "shell32")
222 #pragma comment(lib, "comctl32")
223 #pragma comment(lib, "ole32")
224 #pragma comment(lib, "oleaut32")
225 #pragma comment(lib, "uuid")
226 #pragma comment(lib, "rpcrt4")
227 #pragma comment(lib, "advapi32")
228 #pragma comment(lib, "wsock32")
229 #if wxUSE_URL_NATIVE
230 #pragma comment(lib, "wininet")
231 #endif
232
233 #ifdef __WXGTK__
234 #pragma comment(lib, "gtk-win32-2.0.lib")
235 #pragma comment(lib, "gdk-win32-2.0.lib")
236 #pragma comment(lib, "pangocairo-1.0.lib")
237 #pragma comment(lib, "gdk_pixbuf-2.0.lib")
238 #pragma comment(lib, "cairo.lib")
239 #pragma comment(lib, "pango-1.0.lib")
240 #pragma comment(lib, "gobject-2.0.lib")
241 #pragma comment(lib, "gthread-2.0.lib")
242 #pragma comment(lib, "glib-2.0.lib")
243 #endif
244 #endif // !WXUSINGDLL