]> git.saurik.com Git - wxWidgets.git/blame - build/bakefiles/wxpresets/presets/wx.bkl
remove extra semicolons
[wxWidgets.git] / build / bakefiles / wxpresets / presets / wx.bkl
CommitLineData
83c7f6a7
VS
1<?xml version="1.0" ?>
2<!-- $Id$ -->
3
4<!--
ad6f7122 5 Presets for building wxWidgets applications.
83c7f6a7 6
e602dae8
KO
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
5a5f4ba4
VZ
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
c4106e3b
VZ
67
68 - <wxlike-paths>: if your library/application needs to compile & link with both
e602dae8
KO
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
a6e13ce4
VZ
81 - <set-wxlike>: sets a variable with the name of a library named with the same
82 wxWidgets rules.
83
e602dae8
KO
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>
54429bb3 90 <wx-lib>stc</wx-lib>
e602dae8 91 <wx-lib>qa</wx-lib>
e602dae8 92 <wx-lib>gl</wx-lib>
e602dae8
KO
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
83c7f6a7
VS
102-->
103
104
105<makefile>
ad6f7122 106
d65cbb37
VZ
107 <requires version="0.2.2"/>
108
109
ad6f7122 110 <!-- this variable identifies the version of the wx presets.
18cea871
RD
111 this is changed only when major changes to wxpresets take place.
112 -->
e602dae8 113 <set var="WX_PRESETS_VERSION">4</set>
c81032a7 114
e602dae8
KO
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 -->
18cea871 119 <set var="WX_LIB_LIST">
1e6b2edf 120 base core net xml xrc html adv media gl qa aui richtext stc
591a46d4 121 </set>
c81032a7 122
a78a8f7f
VZ
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
dd5cb4b1
VZ
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
e602dae8
KO
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>
5a5f4ba4 192 Use DLL build of wx library?
e602dae8
KO
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>
5a5f4ba4 206 Use Unicode build of wxWidgets?
e602dae8
KO
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')">
c4106e3b 224 <set var="WX_VERSION_DEFAULT" overwrite="0">29</set>
e602dae8
KO
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
dd5cb4b1
VZ
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>
43daffe5 248 <option name="WX_DIR" category="path" never_empty="1">
dd5cb4b1
VZ
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
c81032a7 256
ad6f7122 257
e602dae8
KO
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
001c0021
FM
273 <!-- REAL IMPLEMENTATION -->
274 <!-- -->
83c7f6a7
VS
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
001c0021
FM
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
83c7f6a7
VS
295 <if cond="__wx_included_impl=='0'">
296 <error>This format is not (yet) supported by wx preset.</error>
297 </if>
298
e602dae8
KO
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 console applications -->
326 <template id="wxconsole" template="wx">
327 <define>wxUSE_GUI=0</define>
328 <app-type>console</app-type>
329 </template>
330
331
332
333 <!-- UTILITY TAGS -->
334 <!-- -->
335
a6e13ce4
VZ
336 <!-- private helper tag: does the same thing as for <set-wxlike> except that:
337 - the variable created is always named "__temp"
338 - can be used (only) inside targets as this is a non-global tag
339 -->
5a5f4ba4 340 <define-tag name="__setlibname" rules="lib,dll,module,exe">
e602dae8
KO
341 <set var="__temp">
342 <if cond="FORMAT!='autoconf' and FORMAT!='gnu'">
343 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
344 </if>
345 <if cond="FORMAT=='autoconf' or FORMAT=='gnu'">
346 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
347 </if>
348 </set>
349 </define-tag>
350
351 <!-- A simple tag which helps you to define a library name using the same rules used
352 by wxWidgets. Use the 'prefix' attribute to add your lib's prefix.
353 E.g.:
354 <wxlike-libname prefix='mylib'>module1</wxlike-libname>
355 <wxlike-libname prefix='mylib'>module2</wxlike-libname>
356 -->
357 <define-tag name="wxlike-libname" rules="lib">
358 <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
359 <libname>$(__temp)</libname>
360 </define-tag>
361
362 <!-- exactly like <wxlike-libname> but this one sets the DLL name (and the DLL lib import name)
363 and thus must be used only inside a <dll> target...
364 -->
365 <define-tag name="wxlike-dllname" rules="dll,module">
366 <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
367 <libname>$(__temp)</libname>
368 <dllname>$(__temp)</dllname>
369 </define-tag>
370
371 <!-- Links against a library which uses the same wxWidgets conventions.
372 -->
373 <define-tag name="wxlike-lib" rules="exe,lib,dll,module">
374 <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
375 <sys-lib>$(__temp)</sys-lib>
376 </define-tag>
377
5a5f4ba4
VZ
378 <!-- Sets as output folder for the current target a directory
379 called "$(value)/$(COMPILER)_lib|dll", just like wxWidgets does.
380 This makes it possible to keep separed the libraries/exes compiled with
e602dae8
KO
381 different compilers and with a different value for WX_SHARED.
382 -->
5a5f4ba4 383 <define-tag name="wxlike-dirname" rules="lib,dll,exe,module">
e602dae8
KO
384 <if cond="FORMAT!='autoconf'">
385 <set var="_DIRNAME_SHARED_SUFFIX">
386 <if cond="WX_SHARED=='0'">lib</if>
387 <if cond="WX_SHARED=='1'">dll</if>
388 </set>
389 <set var="_DIRNAME">
c4106e3b 390 $(value)/$(COMPILER)_$(_DIRNAME_SHARED_SUFFIX)
e602dae8
KO
391 </set>
392
393 <dirname>$(_DIRNAME)</dirname>
394
c4106e3b 395 <if cond="FORMAT_SUPPORTS_ACTIONS=='1'">
5a5f4ba4 396 <set var="__mkdir_tgt">make_dir_$(id)</set>
c4106e3b
VZ
397
398 <add-target target="$(__mkdir_tgt)" type="action"/>
399 <modify-target target="$(__mkdir_tgt)">
400 <command cond="TOOLSET=='unix'">
401 @mkdir -p $(_DIRNAME)
402 </command>
403 <command cond="TOOLSET in ['win32','os2','dos']">
404 if not exist $(nativePaths(_DIRNAME)) mkdir $(nativePaths(_DIRNAME))
405 </command>
001c0021 406 </modify-target>
e602dae8 407
c4106e3b
VZ
408 <!-- the following code is mostly equivalent to a:
409 <dependency-of>$(id)</dependency-of>
410 put into the __mkdir_tgt target, except that it does _prepend_
411 the __mkdir_tgt dependency instead of appending it.
412
413 This is required because some compilers (e.g. MSVC) need to store in the
414 output folder some files (e.g. the PDB file) while compiling and thus
415 the library output folder must have been created before _any_ source file
416 is compiled, not just before the library is linked.
417 -->
418 <modify-target target="$(id)">
419 <set var="__deps" prepend="1">
420 $(substitute(__mkdir_tgt, lambda x: ref('__depname', x), 'DEP'))
421 </set>
422 </modify-target>
423 </if>
e602dae8
KO
424 </if>
425 <if cond="FORMAT=='autoconf'">
c4106e3b
VZ
426 <set var="_DIRNAME">$(value)</set>
427 <dirname>$(_DIRNAME)</dirname>
e602dae8
KO
428 </if>
429 </define-tag>
430
431 <!-- Adds to the compiler & linker flags the path for the "include" and the
432 "lib" folders of a library following wxWidgets conventions which is
433 located in $(value).
434 -->
435 <define-tag name="wxlike-paths" rules="exe,lib,dll,module">
c4106e3b 436 <if cond="FORMAT!='autoconf' and FORMAT!='gnu'">
e602dae8
KO
437 <!-- WXLIBPATH is a path like "/lib/vc_lib"
438 NOTE: even if this template is going to be used for a "lib"
439 target (which does not uses lib-paths at all), we can still
440 use the <lib-path> target: it will just be discarded
441 -->
442 <lib-path>$(value)$(WXLIBPATH)</lib-path>
443
444 <!-- no special include paths for a lib following wxWidgets naming
445 conventions -->
446 <include>$(value)/include</include>
447 </if>
448
449 <!-- for autoconf format the user should use CPPFLAGS and LDFLAGS to
450 specify non-system paths since the wx-based library should have
451 been installed in standard paths
452 -->
453 </define-tag>
454
a6e13ce4
VZ
455
456
457 <!-- UTILITY GLOBAL TAGS -->
458 <!-- -->
459
e602dae8
KO
460 <!-- Sets the BUILDDIR variable using the same rules used by wxWidgets itself.
461 This makes it possible to keep separed the object files compiled with
462 different configuration settings.
463 -->
464 <define-global-tag name="set-wxlike-builddir">
465 <!-- note that the builddir for autoconf should always be '.' -->
466 <if cond="FORMAT!='autoconf'">
467 <set var="_BUILDDIR_SHARED_SUFFIX">
468 <if cond="WX_SHARED=='0'"></if>
469 <if cond="WX_SHARED=='1'">_dll</if>
470 </set>
471
472 <set var="BUILDDIR">
473 $(COMPILER)$(WX_PORT)$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)
474 </set>
475 </if>
476 </define-global-tag>
477
a6e13ce4
VZ
478 <!-- Sets a variable with the name of the 'var' attribute value using the
479 same rules used for wxWidgets library naming.
480 E.g.
481
482 <set-wxlike var='MYMODULE_LIBNAME' prefix='mylib'>
483 mymodule
484 </set-wxlike>
485
486 This tag also supports a 'cond' attribute making it very powerful
487 for conditional linking a wx-based library:
488
489 <option name="USE_MYMODULE">
490 <values>0,1</values>
491 </option>
492 <set-wxlike var='MYMODULE_DEP'
493 prefix='mylib'
494 cond="USE_MYMODULE=='1'">
495 mymodule
496 </set-wxlike>
497 ...
498 <exe id="myexe">
499 <sys-lib>$(MYMODULE_DEP)</sys-lib>
500 </exe>
501 -->
502 <define-global-tag name="set-wxlike">
503 <if cond="FORMAT!='autoconf' and FORMAT!='gnu'">
504 <if cond="'cond' not in attributes">
505 <set var="$(attributes['var'])">
506 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
507 </set>
508 </if>
509 <if cond="'cond' in attributes">
510 <set var="$(attributes['var'])">
511 <if cond="$(attributes['cond'])">
512 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
513 </if>
514 </set>
515 </if>
516 </if>
517
518 <if cond="FORMAT=='autoconf' or FORMAT=='gnu'">
519 <if cond="'cond' not in attributes">
520 <set var="$(attributes['var'])">
521 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
522 </set>
523 </if>
524 <if cond="'cond' in attributes">
525 <set var="$(attributes['var'])">
526 <if cond="$(attributes['cond'])">
527 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
528 </if>
529 </set>
530 </if>
531 </if>
532 </define-global-tag>
533
83c7f6a7 534</makefile>