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