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