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