4 <!-- Original source: http://wiki.wxwidgets.org/wiki.pl?Bakefile -->
5 <!-- Modified by: Francesco Montorsi <frm@users.sourceforge.net> -->
6 <!-- Vaclav Slavik <vslavik@fastmail.fm> to better fit
7 into Bakefile's presets -->
8 <!-- Creation date: 6/9/2004 -->
9 <!-- Last revision: 22/1/2005 off-CVS -->
15 FIXME: this template has (at least) the following bugs:
17 * it's MSW-only, the port is assumed to be wxMSW unconditionally
19 * multiple wx configurations (CFG variable set when building the
20 library) are not supported
24 <!-- makefile tag signifies the beginning of the bakefile -->
27 <requires version="0.1.5"/>
31 <!-- These are essentially the configurations you -->
32 <!-- want in bakefile. -->
34 <!-- In MSVC these are the different build -->
35 <!-- configurations you can have (in the build menu), -->
36 <!-- and in autoconf is enabled with enable-xxx=xx. -->
37 <!-- For other compilers a separate configuration -->
38 <!-- file is created (such as config.gcc on gcc) -->
39 <!-- which has several options a user can modify. -->
41 <!-- Note that the above only happens if an option -->
42 <!-- is not constant, i.e. if it cannot be determined -->
43 <!-- by bakefile itself. -->
45 <!-- this is a temporary variable until there is non general -->
46 <!-- function in bakefiles for returning native markup for -->
47 <!-- reading envrionment variables -->
49 <if cond="FORMAT=='watcom'">%</if>
50 <if cond="FORMAT!='watcom'"></if>
54 <!-- Presets for limited dmars make.exe format: -->
55 <if cond="FORMAT=='dmars'">
56 <set var="WX_UNICODE">0</set>
57 <set var="WX_DEBUG">1</set>
58 <set var="WX_SHARED">0</set>
62 <!-- The directory where wxWidgets is installed: -->
63 <if cond="not isdefined('WX_DIR')">
64 <set var="WX_DIR_DEFAULT" overwrite="0">$(DOLLAR)($(ENV_VAR)WXWIN)</set>
65 <option name="WX_DIR" category="path">
66 <default-value>$(WX_DIR_DEFAULT)</default-value>
68 The directory where wxWidgets library is installed
73 <!-- This is a standard option that determines -->
74 <!-- whether the user wants to build this library as -->
75 <!-- a dll or as a static library. -->
76 <if cond="not isdefined('WX_SHARED')">
77 <set var="WX_SHARED_DEFAULT" overwrite="0">0</set>
78 <option name="WX_SHARED">
80 <values-description>,DLL</values-description>
81 <default-value>$(WX_SHARED_DEFAULT)</default-value>
83 Use DLL build of wx library to use?
88 <!-- Configuration for building the bakefile with -->
89 <!-- unicode strings or not (unicode or ansi). -->
90 <if cond="not isdefined('WX_UNICODE')">
91 <set var="WX_UNICODE_DEFAULT" overwrite="0">0</set>
92 <option name="WX_UNICODE">
94 <values-description>,Unicode</values-description>
95 <default-value>$(WX_UNICODE_DEFAULT)</default-value>
97 Compile Unicode build of wxWidgets?
102 <if cond="not isdefined('WX_DEBUG')">
103 <set var="WX_DEBUG_DEFAULT" overwrite="0">1</set>
104 <option name="WX_DEBUG">
106 <values-description>Release,Debug</values-description>
107 <default-value>$(WX_DEBUG_DEFAULT)</default-value>
109 Use debug build of wxWidgets (define __WXDEBUG__)?
114 <if cond="not isdefined('WX_VERSION')">
115 <set var="WX_VERSION_DEFAULT" overwrite="0">27</set>
116 <option name="WX_VERSION">
117 <default-value>$(WX_VERSION_DEFAULT)</default-value>
119 Version of the wx library to build against.
124 <if cond="not isdefined('WX_MONOLITHIC')">
125 <set var="WX_MONOLITHIC_DEFAULT" overwrite="0">0</set>
126 <option name="WX_MONOLITHIC">
128 <default-value>$(WX_MONOLITHIC_DEFAULT)</default-value>
130 Use monolithic build of wxWidgets?
136 <!-- HELPER VARIABLES -->
140 <!-- The unicode define we want. By default bakefile -->
141 <!-- makes variables an empty string, so if unicode -->
142 <!-- is not defined $(UNICODE_DEFINE) would expand -->
143 <!-- to nothing (literally). -->
144 <set var="WXUNICODE_DEFINE">
145 <if cond="WX_UNICODE=='1'">_UNICODE</if>
148 <!-- The debug define we need with win32 compilers -->
149 <!-- (on Linux, the wx-config program is used). -->
150 <set var="WXDEBUG_DEFINE">
151 <if cond="WX_DEBUG=='1'">__WXDEBUG__</if>
154 <!-- These are handy ways of dealing with the -->
155 <!-- extensions in the library names of the -->
156 <!-- wxWindows library. -->
157 <set var="WXLIBPOSTFIX">
158 <if cond="WX_DEBUG=='1' and WX_UNICODE=='1'">ud</if>
159 <if cond="WX_DEBUG=='1' and WX_UNICODE=='0'">d</if>
160 <if cond="WX_DEBUG=='0' and WX_UNICODE=='1'">u</if>
162 <set var="WX3RDPARTYLIBPOSTFIX">
163 <if cond="WX_DEBUG=='1'">d</if>
167 <if cond="FORMAT=='msevc4prj'">_$(CPU)</if>
170 <set var="WXLIBPATH">
171 <if cond="WX_SHARED=='0'">$(DIRSEP)lib$(DIRSEP)$(COMPILER)$(WXCPU)_lib</if>
172 <if cond="WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER)$(WXCPU)_dll</if>
176 <if cond="FORMAT=='msevc4prj'">wince</if>
177 <if cond="FORMAT!='msevc4prj'">msw</if>
179 <set var="WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WXPORT)$(WXLIBPOSTFIX)</set>
182 <!-- All the possible mixes for the wx library names -->
183 <set var="WXLIB_BASE_NAME">
184 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)</if>
185 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d</if>
186 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u</if>
187 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud</if>
190 the trick used to support monolithic builds is here: when the
191 <wx-lib>base</wx-lib> tag is found, and user selected
192 WX_MONOLITHIC=1, then the base library is translated to the
195 <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)</if>
196 <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d</if>
197 <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u</if>
198 <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud</if>
201 <!-- Libraries whose name is prefixed with 'wxbase' -->
202 <set var="WXLIB_NET_NAME">
203 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)_net</if>
204 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d_net</if>
205 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u_net</if>
206 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud_net</if>
208 <set var="WXLIB_XML_NAME">
209 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)_xml</if>
210 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d_xml</if>
211 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u_xml</if>
212 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud_xml</if>
214 <set var="WXLIB_ODBC_NAME">
215 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)_odbc</if>
216 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d_odbc</if>
217 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u_odbc</if>
218 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud_odbc</if>
221 <!-- Libraries whose name is prefixed with 'wx' only -->
222 <set var="WXLIB_CORE_NAME">
223 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_core</if>
224 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_core</if>
225 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_core</if>
226 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_core</if>
228 <set var="WXLIB_XRC_NAME">
229 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_xrc</if>
230 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_xrc</if>
231 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_xrc</if>
232 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_xrc</if>
234 <set var="WXLIB_HTML_NAME">
235 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_html</if>
236 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_html</if>
237 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_html</if>
238 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_html</if>
240 <set var="WXLIB_ADV_NAME">
241 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_adv</if>
242 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_adv</if>
243 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_adv</if>
244 <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_adv</if>
255 <!-- While not required, templates make your -->
256 <!-- bakefiles much more readable. Templates, in -->
257 <!-- essence, are abstract classes like c++. -->
259 <!-- Your build targets "inherit" the template, -->
260 <!-- along with the info associated with the template -->
263 <!-- wxWidgets LIBRARY/APP TEMPLATE -->
265 <!-- The "base class" of all our build targets -->
266 <!-- This links with the appropriate native -->
267 <!-- libraries required by the platform, the libraries -->
268 <!-- we want for our stuff, and the wxWindows libs. -->
272 <!-- this tag is used to include wx libraries: -->
273 <define-tag name="wx-lib" rules="exe,dll,module">
274 <if cond="value=='base'"><sys-lib>$(WXLIB_BASE_NAME)</sys-lib></if>
275 <if cond="value=='core'"><sys-lib>$(WXLIB_CORE_NAME)</sys-lib></if>
277 <if cond="value=='net'"><sys-lib>$(WXLIB_NET_NAME)</sys-lib></if>
278 <if cond="value=='xml'"><sys-lib>$(WXLIB_XML_NAME)</sys-lib></if>
279 <if cond="value=='odbc'"><sys-lib>$(WXLIB_ODBC_NAME)</sys-lib></if>
281 <if cond="value=='xrc'"><sys-lib>$(WXLIB_XRC_NAME)</sys-lib></if>
282 <if cond="value=='html'"><sys-lib>$(WXLIB_HTML_NAME)</sys-lib></if>
283 <if cond="value=='adv'"><sys-lib>$(WXLIB_ADV_NAME)</sys-lib></if>
285 <if cond="value not in [ 'base', 'core', 'net', 'xml', 'odbc', 'xrc', 'html', 'adv' ]">
286 <error>Unknown wxWidgets library given in the wx-lib tag</error>
290 <!-- just a placeholder to mark the place where <wx-lib> will be placed,
291 thanks to the order precedence declaration below it: -->
292 <define-tag name="__wx-libs-point" rules="exe,dll,module"/>
293 <tag-info name="wx-lib"
294 position="before:__wx-libs-point"/>
295 <tag-info name="__wx-syslibs"
296 position="after:__wx-libs-point"/>
299 <!-- template for static wx libraries: -->
300 <template id="wx-lib">
301 <!-- MISCELLANEOUS -->
302 <if cond="FORMAT=='mingw'">
303 <define>HAVE_W32API_H</define>
304 <ldflags>-mthreads</ldflags>
307 <define>$(WXUNICODE_DEFINE)</define>
308 <define>$(WXDEBUG_DEFINE)</define>
309 <define>__WXMSW__</define>
311 <include>$(WX_DIR)$(WXLIBINCLUDE)</include>
312 <include>$(WX_DIR)/include</include>
316 <!-- this ugly tag contains all sys-lib tags used by "wx" template,
317 in order to make sure they are not reorder when wx-lib is moved
318 after __wx-libs-point: -->
319 <define-tag name="__wx-syslibs" rules="exe,dll,module">
320 <!-- wx 3rd party libs, always use them: -->
321 <sys-lib cond="FORMAT!='msevc4prj'">wxtiff$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
322 <sys-lib>wxjpeg$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
323 <sys-lib>wxpng$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
324 <sys-lib>wxzlib$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
325 <!-- For regex we won't use the WX3RDPARTYLIBPOSTIX postfix:
326 unliked tiff, jpeg, png, zlib, expat, when building
327 in Unicode mode, the "u" suffix is appended to regex -->
328 <sys-lib cond="FORMAT!='msevc4prj'">wxregex$(WXLIBPOSTFIX)</sys-lib>
329 <sys-lib>wxexpat$(WX3RDPARTYLIBPOSTFIX)</sys-lib>
331 <!-- link-in system libs that wx depends on: -->
332 <!-- If on borland, we don't need to do much -->
333 <if cond="FORMAT=='borland'">
334 <sys-lib>ole2w32</sys-lib>
335 <sys-lib>odbc32</sys-lib>
338 <!-- Non-borland, on the other hand... -->
339 <if cond="FORMAT not in ['borland','msevc4prj']">
340 <sys-lib>kernel32</sys-lib>
341 <sys-lib>user32</sys-lib>
342 <sys-lib>gdi32</sys-lib>
343 <sys-lib>comdlg32</sys-lib>
344 <sys-lib>winspool</sys-lib>
345 <sys-lib>winmm</sys-lib>
346 <sys-lib>shell32</sys-lib>
347 <sys-lib>comctl32</sys-lib>
348 <sys-lib>ole32</sys-lib>
349 <sys-lib>oleaut32</sys-lib>
350 <sys-lib>uuid</sys-lib>
351 <sys-lib>rpcrt4</sys-lib>
352 <sys-lib>advapi32</sys-lib>
353 <sys-lib>wsock32</sys-lib>
354 <sys-lib>odbc32</sys-lib>
357 <!-- Libs common to both borland and MSVC -->
358 <if cond="FORMAT=='msvc' or FORMAT=='msvc6prj' or FORMAT=='borland'">
359 <sys-lib>oleacc</sys-lib>
363 <!-- template for wx executables/dlls: -->
364 <template id="wx" template="wx-lib">
365 <lib-path>$(WX_DIR)$(WXLIBPATH)</lib-path>
367 <!-- wx libs must come before 3rd party and sys libs, this is
368 the place where the hack explained above is carried on: -->