]> git.saurik.com Git - wxWidgets.git/blob - build/bakefiles/wxpresets/presets/wx.bkl
compilation fix
[wxWidgets.git] / build / bakefiles / wxpresets / presets / wx.bkl
1 <?xml version="1.0" ?>
2 <!-- $Id$ -->
3
4 <!--
5 Presets for building wxWidgets applications.
6
7 These presets provide the following "public" interface:
8
9 OPTIONS:
10
11 - WX_* : used to let the user of the generated makefile choose a wxWidgets
12 build among those available; you can use them in your project to
13 e.g. build a target only if WX_DEBUG is 0 or if WX_PORT is "msw".
14
15
16 VARIABLES:
17
18 - WXLIBPOSTFIX: contains the [u][d] string which is typically useful when
19 defining names of directories/files which should coexist
20 with other builds using different wxWidgets configurations.
21
22
23 TEMPLATES:
24
25 - wx, wx-lib: templates to be used respectively for <dll>/<exe> and <lib>
26 targets; they add all the wxWidgets-related settings (e.g. the
27 include and library search paths, the __WXDEBUG__ symbol, etc)
28
29 - wxconsole: to be used when building console-only libraries or apps
30 (adds the wxUSE_GUI=0 define).
31
32 - wxlike: this template should be combined with "wx" or "wx-lib" and will
33 make your project build with the same Unicode, debug & shared
34 config as the wxWidgets build selected using the WX_* options.
35
36
37 TARGET TAGS:
38
39 - <wx-lib>: to define which wxWidgets libraries to link with;
40 please note that you should use them in the right order or
41 linking under Unix would result in errors, e.g.
42
43 <wx-lib>core</wx-lib>
44 <wx-lib>base</wx-lib>
45
46 is correct, but the reverse is not (if lib A depends on lib B, then
47 lib A must be listed before B). So <wx-lib>base</wx-lib>
48 (which must always be present) should be the last wx-lib tag.
49
50 - <wxlike-libname>,
51 <wxlike-dllname>: useful if you want to have a build logic similar to the
52 wxWidgets build logic which allows different builds to
53 coexist without conflicts. These tags helps you to name
54 libraries using the same wxWidgets rules and thus avoid
55 conflicts between libraries compiled in e.g. Unicode,
56 shared mode and those compiled in ANSI, shared mode &c.
57
58 - <wxlike-lib>: if your library/application needs to link with both
59 wxWidgets and some other wx-based library, which in turn
60 follows the wxWidgets naming conventions, then this tag is
61 what you need to reference the wx-based additional library.
62
63 - <wxlike-dirname>: sets the output directory for the current target to $(value)
64 when on Unix and to e.g. $(value)/vc_lib when on Windows,
65 i.e. acts like <dirname> just following wxWidgets naming rules.
66 Useful to allow multiple builds of the
67
68 - <wxlike-paths>: if your library/application needs to compile & link with both
69 wxWidgets and some other wx-based library, which in turn
70 follows the wxWidgets naming conventions, then this tag is
71 what you need to add to the compiler and linker flags the paths
72 of the "include" and "lib" folders of the wx-based additional library.
73
74
75 GLOBAL TAGS:
76
77 - <set-wxlike-builddir>: sets BUILDDIR using wxWidgets naming rules to help
78 to keep object files compiled with different
79 settings separate.
80
81 - <set-wxlike>: sets a variable with the name of a library named with the same
82 wxWidgets rules.
83
84
85 NOTE: as a reference here is a list of all wxWidgets libraries satisfying
86 the dependency constraints mentioned in <wx-lib> description:
87
88 <wx-lib>richtext</wx-lib>
89 <wx-lib>aui</wx-lib>
90 <wx-lib>stc</wx-lib>
91 <wx-lib>qa</wx-lib>
92 <wx-lib>dbgrid</wx-lib>
93 <wx-lib>gl</wx-lib>
94 <wx-lib>odbc</wx-lib>
95 <wx-lib>xrc</wx-lib>
96 <wx-lib>html</wx-lib>
97 <wx-lib>media</wx-lib>
98 <wx-lib>adv</wx-lib>
99 <wx-lib>net</wx-lib>
100 <wx-lib>xml</wx-lib>
101 <wx-lib>core</wx-lib>
102 <wx-lib>base</wx-lib>
103
104 -->
105
106
107 <makefile>
108
109 <requires version="0.2.2"/>
110
111
112 <!-- this variable identifies the version of the wx presets.
113 this is changed only when major changes to wxpresets take place.
114 -->
115 <set var="WX_PRESETS_VERSION">4</set>
116
117 <!-- list of known libraries used by wx-lib tag defined in wx_unix.bkl and wx_win32.bkl
118 VERY IMPORTANT: when updating this list also update the <wx-lib> and <wx-all-libs>
119 tag definitions.
120 -->
121 <set var="WX_LIB_LIST">
122 base core net xml odbc xrc html adv media gl dbgrid qa aui richtext stc
123 </set>
124
125 <!-- if you define this variable to 0 before including wx presets, the
126 "test_for_selected_wxbuild" target which is added by default in win32 and GNU
127 makefiles, won't be added.
128 This is useful when e.g. you want to have wxWidgets as an optional
129 dependency and thus you don't want to perform that check unconditionally.
130 -->
131 <set var="WX_TEST_FOR_SELECTED_WXBUILD" overwrite="0">
132 1
133 </set>
134
135 <!-- this is a temporary variable until there is non general -->
136 <!-- function in bakefiles for returning native markup for -->
137 <!-- reading envrionment variables -->
138 <set var="ENV_VAR">
139 <if cond="FORMAT=='watcom'">%</if>
140 <if cond="FORMAT!='watcom'"></if>
141 </set>
142
143
144
145 <!-- OPTIONS -->
146 <!-- -->
147 <!-- These are essentially the configurations you -->
148 <!-- want in bakefile. -->
149 <!-- -->
150 <!-- In MSVC these are the different build -->
151 <!-- configurations you can have (in the build menu), -->
152 <!-- and in autoconf is enabled with enable-xxx=xx. -->
153 <!-- For other compilers a separate configuration -->
154 <!-- file is created (such as config.gcc on gcc) -->
155 <!-- which has several options a user can modify. -->
156 <!-- -->
157 <!-- Note that the above only happens if an option -->
158 <!-- is not constant, i.e. if it cannot be determined -->
159 <!-- by bakefile itself. -->
160 <!-- Also note that for 'autoconf' format these options -->
161 <!-- are only useful when used together with wxpresets.m4 -->
162 <!-- macro file which contains macros for detecting the -->
163 <!-- option values for wx-based projects. See wxpresets.m4 -->
164 <!-- comments for more info. -->
165
166
167 <!-- Presets for limited dmars make.exe format: -->
168 <if cond="FORMAT=='dmars'">
169 <set var="WX_UNICODE">0</set>
170 <set var="WX_DEBUG">1</set>
171 <set var="WX_SHARED">0</set>
172 </if>
173
174 <!-- 'gnu' format needs to redefine the following options later in wx_unix.bkl -->
175 <if cond="FORMAT=='gnu'">
176 <set var="WX_UNICODE"/>
177 <set var="WX_DEBUG"/>
178 <set var="WX_SHARED"/>
179 <set var="WX_PORT"/>
180 <set var="WX_VERSION"/>
181 </if>
182
183
184 <!-- This is a standard option that determines -->
185 <!-- whether the user wants to build this library as -->
186 <!-- a dll or as a static library. -->
187 <if cond="not isdefined('WX_SHARED')">
188 <set var="WX_SHARED_DEFAULT" overwrite="0">0</set>
189 <option name="WX_SHARED">
190 <values>0,1</values>
191 <values-description>Static,DLL</values-description>
192 <default-value>$(WX_SHARED_DEFAULT)</default-value>
193 <description>
194 Use DLL build of wx library?
195 </description>
196 </option>
197 </if>
198
199 <!-- Configuration for building the bakefile with -->
200 <!-- unicode strings or not (unicode or ansi). -->
201 <if cond="not isdefined('WX_UNICODE')">
202 <set var="WX_UNICODE_DEFAULT" overwrite="0">0</set>
203 <option name="WX_UNICODE">
204 <values>0,1</values>
205 <values-description>ANSI,Unicode</values-description>
206 <default-value>$(WX_UNICODE_DEFAULT)</default-value>
207 <description>
208 Use Unicode build of wxWidgets?
209 </description>
210 </option>
211 </if>
212
213 <if cond="not isdefined('WX_DEBUG')">
214 <set var="WX_DEBUG_DEFAULT" overwrite="0">1</set>
215 <option name="WX_DEBUG">
216 <values>0,1</values>
217 <values-description>Release,Debug</values-description>
218 <default-value>$(WX_DEBUG_DEFAULT)</default-value>
219 <description>
220 Use debug build of wxWidgets (define __WXDEBUG__)?
221 </description>
222 </option>
223 </if>
224
225 <if cond="not isdefined('WX_VERSION')">
226 <set var="WX_VERSION_DEFAULT" overwrite="0">29</set>
227 <option name="WX_VERSION">
228 <default-value>$(WX_VERSION_DEFAULT)</default-value>
229 <description>
230 Version of the wx library to build against.
231 </description>
232 </option>
233 </if>
234
235 <if cond="not isdefined('WX_MONOLITHIC')">
236 <set var="WX_MONOLITHIC_DEFAULT" overwrite="0">0</set>
237 <option name="WX_MONOLITHIC">
238 <values>0,1</values>
239 <values-description>Multilib,Monolithic</values-description>
240 <default-value>$(WX_MONOLITHIC_DEFAULT)</default-value>
241 <description>
242 Use monolithic build of wxWidgets?
243 </description>
244 </option>
245 </if>
246
247 <!-- The directory where wxWidgets is installed: -->
248 <if cond="not isdefined('WX_DIR')">
249 <set var="WX_DIR_DEFAULT" overwrite="0">$(DOLLAR)($(ENV_VAR)WXWIN)</set>
250 <option name="WX_DIR" category="path">
251 <default-value>$(WX_DIR_DEFAULT)</default-value>
252 <description>
253 The directory where wxWidgets library is installed
254 </description>
255 </option>
256 </if>
257
258
259
260 <!-- HELPER VARIABLES -->
261 <!-- -->
262
263 <!-- These are handy ways of dealing with the -->
264 <!-- extensions in the library names of the -->
265 <!-- wxWindows library. -->
266 <set var="WXLIBPOSTFIX">
267 <if cond="WX_DEBUG=='1' and WX_UNICODE=='1'">ud</if>
268 <if cond="WX_DEBUG=='1' and WX_UNICODE=='0'">d</if>
269 <if cond="WX_DEBUG=='0' and WX_UNICODE=='1'">u</if>
270 </set>
271
272
273
274
275 <!-- this is just a wrapper that includes the real implementation: -->
276
277 <set var="__wx_included_impl">0</set>
278
279 <if cond="FORMAT in ['autoconf','gnu']">
280 <include file="wx_unix.bkl"/>
281 <set var="__wx_included_impl">1</set>
282 </if>
283
284 <if cond="FORMAT!='autoconf' and PLATFORM_WIN32=='1'">
285 <include file="wx_win32.bkl"/>
286 <set var="__wx_included_impl">1</set>
287 </if>
288
289 <if cond="__wx_included_impl=='0'">
290 <error>This format is not (yet) supported by wx preset.</error>
291 </if>
292
293
294
295
296 <!-- HIGH-LEVEL TEMPLATE -->
297 <!-- -->
298
299 <!-- Combine 'wxlike' with 'wx' or 'wx-lib' templates to have your
300 project build in the same configuration used by the selected
301 wxWidgets build -->
302 <template id="wxlike">
303 <!-- WX_DEBUG-dependent -->
304 <set var="_OPT">
305 <if cond="WX_DEBUG=='1'">off</if>
306 <if cond="WX_DEBUG=='0'">speed</if>
307 </set>
308 <set var="_DEBUGINFO">
309 <if cond="WX_DEBUG=='1'">on</if>
310 <if cond="WX_DEBUG=='0'">off</if>
311 </set>
312
313 <if cond="FORMAT!='autoconf'">
314 <optimize>$(_OPT)</optimize>
315 <debug-info>$(_DEBUGINFO)</debug-info>
316 </if>
317 </template>
318
319 <!-- Template for building wx-based console applications -->
320 <template id="wxconsole" template="wx">
321 <define>wxUSE_GUI=0</define>
322 <app-type>console</app-type>
323 </template>
324
325
326
327 <!-- UTILITY TAGS -->
328 <!-- -->
329
330 <!-- private helper tag: does the same thing as for <set-wxlike> except that:
331 - the variable created is always named "__temp"
332 - can be used (only) inside targets as this is a non-global tag
333 -->
334 <define-tag name="__setlibname" rules="lib,dll,module,exe">
335 <set var="__temp">
336 <if cond="FORMAT!='autoconf' and FORMAT!='gnu'">
337 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
338 </if>
339 <if cond="FORMAT=='autoconf' or FORMAT=='gnu'">
340 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
341 </if>
342 </set>
343 </define-tag>
344
345 <!-- A simple tag which helps you to define a library name using the same rules used
346 by wxWidgets. Use the 'prefix' attribute to add your lib's prefix.
347 E.g.:
348 <wxlike-libname prefix='mylib'>module1</wxlike-libname>
349 <wxlike-libname prefix='mylib'>module2</wxlike-libname>
350 -->
351 <define-tag name="wxlike-libname" rules="lib">
352 <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
353 <libname>$(__temp)</libname>
354 </define-tag>
355
356 <!-- exactly like <wxlike-libname> but this one sets the DLL name (and the DLL lib import name)
357 and thus must be used only inside a <dll> target...
358 -->
359 <define-tag name="wxlike-dllname" rules="dll,module">
360 <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
361 <libname>$(__temp)</libname>
362 <dllname>$(__temp)</dllname>
363 </define-tag>
364
365 <!-- Links against a library which uses the same wxWidgets conventions.
366 -->
367 <define-tag name="wxlike-lib" rules="exe,lib,dll,module">
368 <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
369 <sys-lib>$(__temp)</sys-lib>
370 </define-tag>
371
372 <!-- Sets as output folder for the current target a directory
373 called "$(value)/$(COMPILER)_lib|dll", just like wxWidgets does.
374 This makes it possible to keep separed the libraries/exes compiled with
375 different compilers and with a different value for WX_SHARED.
376 -->
377 <define-tag name="wxlike-dirname" rules="lib,dll,exe,module">
378 <if cond="FORMAT!='autoconf'">
379 <set var="_DIRNAME_SHARED_SUFFIX">
380 <if cond="WX_SHARED=='0'">lib</if>
381 <if cond="WX_SHARED=='1'">dll</if>
382 </set>
383 <set var="_DIRNAME">
384 $(value)/$(COMPILER)_$(_DIRNAME_SHARED_SUFFIX)
385 </set>
386
387 <dirname>$(_DIRNAME)</dirname>
388
389 <if cond="FORMAT_SUPPORTS_ACTIONS=='1'">
390 <set var="__mkdir_tgt">make_dir_$(id)</set>
391
392 <add-target target="$(__mkdir_tgt)" type="action"/>
393 <modify-target target="$(__mkdir_tgt)">
394 <command cond="TOOLSET=='unix'">
395 @mkdir -p $(_DIRNAME)
396 </command>
397 <command cond="TOOLSET in ['win32','os2','dos']">
398 if not exist $(nativePaths(_DIRNAME)) mkdir $(nativePaths(_DIRNAME))
399 </command>
400 </modify-target>
401
402 <!-- the following code is mostly equivalent to a:
403 <dependency-of>$(id)</dependency-of>
404 put into the __mkdir_tgt target, except that it does _prepend_
405 the __mkdir_tgt dependency instead of appending it.
406
407 This is required because some compilers (e.g. MSVC) need to store in the
408 output folder some files (e.g. the PDB file) while compiling and thus
409 the library output folder must have been created before _any_ source file
410 is compiled, not just before the library is linked.
411 -->
412 <modify-target target="$(id)">
413 <set var="__deps" prepend="1">
414 $(substitute(__mkdir_tgt, lambda x: ref('__depname', x), 'DEP'))
415 </set>
416 </modify-target>
417 </if>
418 </if>
419 <if cond="FORMAT=='autoconf'">
420 <set var="_DIRNAME">$(value)</set>
421 <dirname>$(_DIRNAME)</dirname>
422 </if>
423 </define-tag>
424
425 <!-- Adds to the compiler & linker flags the path for the "include" and the
426 "lib" folders of a library following wxWidgets conventions which is
427 located in $(value).
428 -->
429 <define-tag name="wxlike-paths" rules="exe,lib,dll,module">
430 <if cond="FORMAT!='autoconf' and FORMAT!='gnu'">
431 <!-- WXLIBPATH is a path like "/lib/vc_lib"
432 NOTE: even if this template is going to be used for a "lib"
433 target (which does not uses lib-paths at all), we can still
434 use the <lib-path> target: it will just be discarded
435 -->
436 <lib-path>$(value)$(WXLIBPATH)</lib-path>
437
438 <!-- no special include paths for a lib following wxWidgets naming
439 conventions -->
440 <include>$(value)/include</include>
441 </if>
442
443 <!-- for autoconf format the user should use CPPFLAGS and LDFLAGS to
444 specify non-system paths since the wx-based library should have
445 been installed in standard paths
446 -->
447 </define-tag>
448
449
450
451 <!-- UTILITY GLOBAL TAGS -->
452 <!-- -->
453
454 <!-- Sets the BUILDDIR variable using the same rules used by wxWidgets itself.
455 This makes it possible to keep separed the object files compiled with
456 different configuration settings.
457 -->
458 <define-global-tag name="set-wxlike-builddir">
459 <!-- note that the builddir for autoconf should always be '.' -->
460 <if cond="FORMAT!='autoconf'">
461 <set var="_BUILDDIR_SHARED_SUFFIX">
462 <if cond="WX_SHARED=='0'"></if>
463 <if cond="WX_SHARED=='1'">_dll</if>
464 </set>
465
466 <set var="BUILDDIR">
467 $(COMPILER)$(WX_PORT)$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)
468 </set>
469 </if>
470 </define-global-tag>
471
472 <!-- Sets a variable with the name of the 'var' attribute value using the
473 same rules used for wxWidgets library naming.
474 E.g.
475
476 <set-wxlike var='MYMODULE_LIBNAME' prefix='mylib'>
477 mymodule
478 </set-wxlike>
479
480 This tag also supports a 'cond' attribute making it very powerful
481 for conditional linking a wx-based library:
482
483 <option name="USE_MYMODULE">
484 <values>0,1</values>
485 </option>
486 <set-wxlike var='MYMODULE_DEP'
487 prefix='mylib'
488 cond="USE_MYMODULE=='1'">
489 mymodule
490 </set-wxlike>
491 ...
492 <exe id="myexe">
493 <sys-lib>$(MYMODULE_DEP)</sys-lib>
494 </exe>
495 -->
496 <define-global-tag name="set-wxlike">
497 <if cond="FORMAT!='autoconf' and FORMAT!='gnu'">
498 <if cond="'cond' not in attributes">
499 <set var="$(attributes['var'])">
500 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
501 </set>
502 </if>
503 <if cond="'cond' in attributes">
504 <set var="$(attributes['var'])">
505 <if cond="$(attributes['cond'])">
506 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
507 </if>
508 </set>
509 </if>
510 </if>
511
512 <if cond="FORMAT=='autoconf' or FORMAT=='gnu'">
513 <if cond="'cond' not in attributes">
514 <set var="$(attributes['var'])">
515 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
516 </set>
517 </if>
518 <if cond="'cond' in attributes">
519 <set var="$(attributes['var'])">
520 <if cond="$(attributes['cond'])">
521 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
522 </if>
523 </set>
524 </if>
525 </if>
526 </define-global-tag>
527
528 </makefile>