5 Presets for building wxWidgets applications.
7 These presets provide the following "public" interface:
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".
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.
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).
29 - wxgui: to be used when building GUI-mode applications.
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).
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.
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.
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.
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.
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.
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.
69 Useful to allow multiple builds of the
71 - <wxlike-paths>: if your library/application needs to compile & link with both
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.
80 - <set-wxlike-builddir>: sets BUILDDIR using wxWidgets naming rules to help
81 to keep object files compiled with different
84 - <set-wxlike>: sets a variable with the name of a library named with the same
88 NOTE: as a reference here is a list of all wxWidgets libraries satisfying
89 the dependency constraints mentioned in <wx-lib> description:
91 <wx-lib>richtext</wx-lib>
93 <wx-lib>propgrid</wx-lib>
99 <wx-lib>media</wx-lib>
103 <wx-lib>core</wx-lib>
104 <wx-lib>base</wx-lib>
111 <requires version=
"0.2.2"/>
114 <!-- this variable identifies the version of the wx presets.
115 this is changed only when major changes to wxpresets take place.
117 <set var=
"WX_PRESETS_VERSION">4</set>
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>
123 <set var=
"WX_LIB_LIST">
124 base core net xml xrc html adv media gl qa aui propgrid richtext stc
127 <!-- if you define this variable to 0 before including wx presets, the
128 "test_for_selected_wxbuild" target which is added by default in win32 and GNU
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.
133 <set var=
"WX_TEST_FOR_SELECTED_WXBUILD" overwrite=
"0">
137 <!-- this is a temporary variable until there is non general -->
138 <!-- function in bakefiles for returning native markup for -->
139 <!-- reading envrionment variables -->
141 <if cond=
"FORMAT=='watcom'">%
</if>
142 <if cond=
"FORMAT!='watcom'"></if>
149 <!-- These are essentially the configurations you -->
150 <!-- want in bakefile. -->
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. -->
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. -->
169 <!-- Presets for limited dmars make.exe format: -->
170 <if cond=
"FORMAT=='dmars'">
171 <set var=
"WX_UNICODE">1</set>
172 <set var=
"WX_DEBUG">1</set>
173 <set var=
"WX_SHARED">0</set>
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"/>
182 <set var=
"WX_VERSION"/>
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">
193 <values-description>Static,DLL
</values-description>
194 <default-value>$(WX_SHARED_DEFAULT)
</default-value>
196 Use DLL build of wx library?
201 <!-- Configuration for building the bakefile with -->
202 <!-- unicode strings or not (unicode or ansi). -->
203 <if cond=
"not isdefined('WX_UNICODE')">
204 <set var=
"WX_UNICODE_DEFAULT" overwrite=
"0">1</set>
205 <option name=
"WX_UNICODE">
207 <values-description>ANSI,Unicode
</values-description>
208 <default-value>$(WX_UNICODE_DEFAULT)
</default-value>
210 Use Unicode build of wxWidgets?
215 <if cond=
"not isdefined('WX_DEBUG')">
216 <set var=
"WX_DEBUG_DEFAULT" overwrite=
"0">1</set>
217 <option name=
"WX_DEBUG">
219 <values-description>Release,Debug
</values-description>
220 <default-value>$(WX_DEBUG_DEFAULT)
</default-value>
222 Use debug build of wxWidgets (define __WXDEBUG__)?
227 <if cond=
"not isdefined('WX_VERSION')">
228 <set var=
"WX_VERSION_DEFAULT" overwrite=
"0">29</set>
229 <option name=
"WX_VERSION">
230 <default-value>$(WX_VERSION_DEFAULT)
</default-value>
232 Version of the wx library to build against.
237 <if cond=
"not isdefined('WX_MONOLITHIC')">
238 <set var=
"WX_MONOLITHIC_DEFAULT" overwrite=
"0">0</set>
239 <option name=
"WX_MONOLITHIC">
241 <values-description>Multilib,Monolithic
</values-description>
242 <default-value>$(WX_MONOLITHIC_DEFAULT)
</default-value>
244 Use monolithic build of wxWidgets?
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>
252 <option name=
"WX_DIR" category=
"path" never_empty=
"1">
253 <default-value>$(WX_DIR_DEFAULT)
</default-value>
255 The directory where wxWidgets library is installed
262 <!-- HELPER VARIABLES -->
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>
277 <!-- REAL IMPLEMENTATION -->
280 <set var=
"__wx_included_impl">0</set>
282 <if cond=
"FORMAT in ['autoconf','gnu']">
283 <include file=
"wx_unix.bkl"/>
284 <set var=
"__wx_included_impl">1</set>
287 <if cond=
"FORMAT!='autoconf' and PLATFORM_WIN32=='1'">
288 <include file=
"wx_win32.bkl"/>
289 <set var=
"__wx_included_impl">1</set>
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>
299 <if cond=
"__wx_included_impl=='0'">
300 <error>This format is not (yet) supported by wx preset.
</error>
306 <!-- HIGH-LEVEL TEMPLATE -->
309 <!-- Combine 'wxlike' with 'wx' or 'wx-lib' templates to have your
310 project build in the same configuration used by the selected
312 <template id=
"wxlike">
313 <!-- WX_DEBUG-dependent -->
315 <if cond=
"WX_DEBUG=='1'">off
</if>
316 <if cond=
"WX_DEBUG=='0'">speed
</if>
318 <set var=
"_DEBUGINFO">
319 <if cond=
"WX_DEBUG=='1'">on
</if>
320 <if cond=
"WX_DEBUG=='0'">off
</if>
323 <if cond=
"FORMAT!='autoconf'">
324 <optimize>$(_OPT)
</optimize>
325 <debug-info>$(_DEBUGINFO)
</debug-info>
329 <!-- Template for building wx-based GUI applications -->
330 <template id=
"wxgui" template=
"wx">
331 <app-type>gui
</app-type>
334 <!-- Template for building wx-based console applications -->
335 <template id=
"wxconsole" template=
"wx">
336 <app-type>console
</app-type>
341 <!-- UTILITY TAGS -->
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
348 <define-tag name=
"__setlibname" rules=
"lib,dll,module,exe">
350 <if cond=
"FORMAT!='autoconf' and FORMAT!='gnu'">
351 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
353 <if cond=
"FORMAT=='autoconf' or FORMAT=='gnu'">
354 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
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.
362 <wxlike-libname prefix='mylib'>module1</wxlike-libname>
363 <wxlike-libname prefix='mylib'>module2</wxlike-libname>
365 <define-tag name=
"wxlike-libname" rules=
"lib">
366 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
367 <libname>$(__temp)
</libname>
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...
373 <define-tag name=
"wxlike-dllname" rules=
"dll,module">
374 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
375 <libname>$(__temp)
</libname>
376 <dllname>$(__temp)
</dllname>
379 <!-- Links against a library which uses the same wxWidgets conventions.
381 <define-tag name=
"wxlike-lib" rules=
"exe,lib,dll,module">
382 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
383 <sys-lib>$(__temp)
</sys-lib>
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
389 different compilers and with a different value for WX_SHARED.
391 <define-tag name=
"wxlike-dirname" rules=
"lib,dll,exe,module">
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>
398 $(value)/$(COMPILER)_$(_DIRNAME_SHARED_SUFFIX)
401 <dirname>$(_DIRNAME)
</dirname>
403 <if cond=
"FORMAT_SUPPORTS_ACTIONS=='1'">
404 <set var=
"__mkdir_tgt">make_dir_$(id)
</set>
406 <add-target target=
"$(__mkdir_tgt)" type=
"action"/>
407 <modify-target target=
"$(__mkdir_tgt)">
408 <command cond=
"TOOLSET=='unix'">
409 @mkdir -p $(_DIRNAME)
411 <command cond=
"TOOLSET in ['win32','os2','dos']">
412 if not exist $(nativePaths(_DIRNAME)) mkdir $(nativePaths(_DIRNAME))
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.
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.
426 <modify-target target=
"$(id)">
427 <set var=
"__deps" prepend=
"1">
428 $(substitute(__mkdir_tgt, lambda x: ref('__depname', x), 'DEP'))
433 <if cond=
"FORMAT=='autoconf'">
434 <set var=
"_DIRNAME">$(value)
</set>
435 <dirname>$(_DIRNAME)
</dirname>
439 <!-- Adds to the compiler & linker flags the path for the "include" and the
440 "lib" folders of a library following wxWidgets conventions which is
443 <define-tag name=
"wxlike-paths" rules=
"exe,lib,dll,module">
444 <if cond=
"FORMAT!='autoconf' and FORMAT!='gnu'">
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
450 <lib-path>$(value)$(WXLIBPATH)
</lib-path>
452 <!-- no special include paths for a lib following wxWidgets naming
454 <include>$(value)/include
</include>
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
465 <!-- UTILITY GLOBAL TAGS -->
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.
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>
481 $(COMPILER)$(WX_PORT)$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)
486 <!-- Sets a variable with the name of the 'var' attribute value using the
487 same rules used for wxWidgets library naming.
490 <set-wxlike var='MYMODULE_LIBNAME' prefix='mylib'>
494 This tag also supports a 'cond' attribute making it very powerful
495 for conditional linking a wx-based library:
497 <option name="USE_MYMODULE">
500 <set-wxlike var='MYMODULE_DEP'
502 cond="USE_MYMODULE=='1'">
507 <sys-lib>$(MYMODULE_DEP)</sys-lib>
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)
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)
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)
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)
543 <include file=
"wx_xrc.bkl"/>