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