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