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 - wxconsole: to be used when building console-only libraries or apps
30 (adds the wxUSE_GUI=0 define).
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.
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.
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.
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.
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.
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
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.
77 - <set-wxlike-builddir>: sets BUILDDIR using wxWidgets naming rules to help
78 to keep object files compiled with different
81 - <set-wxlike>: sets a variable with the name of a library named with the same
85 NOTE: as a reference here is a list of all wxWidgets libraries satisfying
86 the dependency constraints mentioned in <wx-lib> description:
88 <wx-lib>richtext</wx-lib>
90 <wx-lib>propgrid</wx-lib>
96 <wx-lib>media</wx-lib>
100 <wx-lib>core</wx-lib>
101 <wx-lib>base</wx-lib>
108 <requires version=
"0.2.2"/>
111 <!-- this variable identifies the version of the wx presets.
112 this is changed only when major changes to wxpresets take place.
114 <set var=
"WX_PRESETS_VERSION">4</set>
116 <!-- list of known libraries used by wx-lib tag defined in wx_unix.bkl and wx_win32.bkl
117 VERY IMPORTANT: when updating this list also update the <wx-lib> and <wx-all-libs>
120 <set var=
"WX_LIB_LIST">
121 base core net xml xrc html adv media gl qa aui propgrid richtext stc
124 <!-- if you define this variable to 0 before including wx presets, the
125 "test_for_selected_wxbuild" target which is added by default in win32 and GNU
126 makefiles, won't be added.
127 This is useful when e.g. you want to have wxWidgets as an optional
128 dependency and thus you don't want to perform that check unconditionally.
130 <set var=
"WX_TEST_FOR_SELECTED_WXBUILD" overwrite=
"0">
134 <!-- this is a temporary variable until there is non general -->
135 <!-- function in bakefiles for returning native markup for -->
136 <!-- reading envrionment variables -->
138 <if cond=
"FORMAT=='watcom'">%
</if>
139 <if cond=
"FORMAT!='watcom'"></if>
146 <!-- These are essentially the configurations you -->
147 <!-- want in bakefile. -->
149 <!-- In MSVC these are the different build -->
150 <!-- configurations you can have (in the build menu), -->
151 <!-- and in autoconf is enabled with enable-xxx=xx. -->
152 <!-- For other compilers a separate configuration -->
153 <!-- file is created (such as config.gcc on gcc) -->
154 <!-- which has several options a user can modify. -->
156 <!-- Note that the above only happens if an option -->
157 <!-- is not constant, i.e. if it cannot be determined -->
158 <!-- by bakefile itself. -->
159 <!-- Also note that for 'autoconf' format these options -->
160 <!-- are only useful when used together with wxpresets.m4 -->
161 <!-- macro file which contains macros for detecting the -->
162 <!-- option values for wx-based projects. See wxpresets.m4 -->
163 <!-- comments for more info. -->
166 <!-- Presets for limited dmars make.exe format: -->
167 <if cond=
"FORMAT=='dmars'">
168 <set var=
"WX_UNICODE">0</set>
169 <set var=
"WX_DEBUG">1</set>
170 <set var=
"WX_SHARED">0</set>
173 <!-- 'gnu' format needs to redefine the following options later in wx_unix.bkl -->
174 <if cond=
"FORMAT=='gnu'">
175 <set var=
"WX_UNICODE"/>
176 <set var=
"WX_DEBUG"/>
177 <set var=
"WX_SHARED"/>
179 <set var=
"WX_VERSION"/>
183 <!-- This is a standard option that determines -->
184 <!-- whether the user wants to build this library as -->
185 <!-- a dll or as a static library. -->
186 <if cond=
"not isdefined('WX_SHARED')">
187 <set var=
"WX_SHARED_DEFAULT" overwrite=
"0">0</set>
188 <option name=
"WX_SHARED">
190 <values-description>Static,DLL
</values-description>
191 <default-value>$(WX_SHARED_DEFAULT)
</default-value>
193 Use DLL build of wx library?
198 <!-- Configuration for building the bakefile with -->
199 <!-- unicode strings or not (unicode or ansi). -->
200 <if cond=
"not isdefined('WX_UNICODE')">
201 <set var=
"WX_UNICODE_DEFAULT" overwrite=
"0">0</set>
202 <option name=
"WX_UNICODE">
204 <values-description>ANSI,Unicode
</values-description>
205 <default-value>$(WX_UNICODE_DEFAULT)
</default-value>
207 Use Unicode build of wxWidgets?
212 <if cond=
"not isdefined('WX_DEBUG')">
213 <set var=
"WX_DEBUG_DEFAULT" overwrite=
"0">1</set>
214 <option name=
"WX_DEBUG">
216 <values-description>Release,Debug
</values-description>
217 <default-value>$(WX_DEBUG_DEFAULT)
</default-value>
219 Use debug build of wxWidgets (define __WXDEBUG__)?
224 <if cond=
"not isdefined('WX_VERSION')">
225 <set var=
"WX_VERSION_DEFAULT" overwrite=
"0">29</set>
226 <option name=
"WX_VERSION">
227 <default-value>$(WX_VERSION_DEFAULT)
</default-value>
229 Version of the wx library to build against.
234 <if cond=
"not isdefined('WX_MONOLITHIC')">
235 <set var=
"WX_MONOLITHIC_DEFAULT" overwrite=
"0">0</set>
236 <option name=
"WX_MONOLITHIC">
238 <values-description>Multilib,Monolithic
</values-description>
239 <default-value>$(WX_MONOLITHIC_DEFAULT)
</default-value>
241 Use monolithic build of wxWidgets?
246 <!-- The directory where wxWidgets is installed: -->
247 <if cond=
"not isdefined('WX_DIR')">
248 <set var=
"WX_DIR_DEFAULT" overwrite=
"0">$(DOLLAR)($(ENV_VAR)WXWIN)
</set>
249 <option name=
"WX_DIR" category=
"path" never_empty=
"1">
250 <default-value>$(WX_DIR_DEFAULT)
</default-value>
252 The directory where wxWidgets library is installed
259 <!-- HELPER VARIABLES -->
262 <!-- These are handy ways of dealing with the -->
263 <!-- extensions in the library names of the -->
264 <!-- wxWindows library. -->
265 <set var=
"WXLIBPOSTFIX">
266 <if cond=
"WX_DEBUG=='1' and WX_UNICODE=='1'">ud
</if>
267 <if cond=
"WX_DEBUG=='1' and WX_UNICODE=='0'">d
</if>
268 <if cond=
"WX_DEBUG=='0' and WX_UNICODE=='1'">u
</if>
274 <!-- REAL IMPLEMENTATION -->
277 <set var=
"__wx_included_impl">0</set>
279 <if cond=
"FORMAT in ['autoconf','gnu']">
280 <include file=
"wx_unix.bkl"/>
281 <set var=
"__wx_included_impl">1</set>
284 <if cond=
"FORMAT!='autoconf' and PLATFORM_WIN32=='1'">
285 <include file=
"wx_win32.bkl"/>
286 <set var=
"__wx_included_impl">1</set>
289 <if cond=
"FORMAT=='xcode2'">
290 <!-- xCode2 is an IDE and thus reuses almost nothing from unix part of wxpresets;
291 better use the win32 part! -->
292 <include file=
"wx_win32.bkl"/>
293 <set var=
"__wx_included_impl">1</set>
296 <if cond=
"__wx_included_impl=='0'">
297 <error>This format is not (yet) supported by wx preset.
</error>
303 <!-- HIGH-LEVEL TEMPLATE -->
306 <!-- Combine 'wxlike' with 'wx' or 'wx-lib' templates to have your
307 project build in the same configuration used by the selected
309 <template id=
"wxlike">
310 <!-- WX_DEBUG-dependent -->
312 <if cond=
"WX_DEBUG=='1'">off
</if>
313 <if cond=
"WX_DEBUG=='0'">speed
</if>
315 <set var=
"_DEBUGINFO">
316 <if cond=
"WX_DEBUG=='1'">on
</if>
317 <if cond=
"WX_DEBUG=='0'">off
</if>
320 <if cond=
"FORMAT!='autoconf'">
321 <optimize>$(_OPT)
</optimize>
322 <debug-info>$(_DEBUGINFO)
</debug-info>
326 <!-- Template for building wx-based GUI applications -->
327 <template id=
"wxgui" template=
"wx">
328 <app-type>gui
</app-type>
331 <!-- Template for building wx-based console applications -->
332 <template id=
"wxconsole" template=
"wx">
333 <app-type>console
</app-type>
338 <!-- UTILITY TAGS -->
341 <!-- private helper tag: does the same thing as for <set-wxlike> except that:
342 - the variable created is always named "__temp"
343 - can be used (only) inside targets as this is a non-global tag
345 <define-tag name=
"__setlibname" rules=
"lib,dll,module,exe">
347 <if cond=
"FORMAT!='autoconf' and FORMAT!='gnu'">
348 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
350 <if cond=
"FORMAT=='autoconf' or FORMAT=='gnu'">
351 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
356 <!-- A simple tag which helps you to define a library name using the same rules used
357 by wxWidgets. Use the 'prefix' attribute to add your lib's prefix.
359 <wxlike-libname prefix='mylib'>module1</wxlike-libname>
360 <wxlike-libname prefix='mylib'>module2</wxlike-libname>
362 <define-tag name=
"wxlike-libname" rules=
"lib">
363 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
364 <libname>$(__temp)
</libname>
367 <!-- exactly like <wxlike-libname> but this one sets the DLL name (and the DLL lib import name)
368 and thus must be used only inside a <dll> target...
370 <define-tag name=
"wxlike-dllname" rules=
"dll,module">
371 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
372 <libname>$(__temp)
</libname>
373 <dllname>$(__temp)
</dllname>
376 <!-- Links against a library which uses the same wxWidgets conventions.
378 <define-tag name=
"wxlike-lib" rules=
"exe,lib,dll,module">
379 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
380 <sys-lib>$(__temp)
</sys-lib>
383 <!-- Sets as output folder for the current target a directory
384 called "$(value)/$(COMPILER)_lib|dll", just like wxWidgets does.
385 This makes it possible to keep separed the libraries/exes compiled with
386 different compilers and with a different value for WX_SHARED.
388 <define-tag name=
"wxlike-dirname" rules=
"lib,dll,exe,module">
389 <if cond=
"FORMAT!='autoconf'">
390 <set var=
"_DIRNAME_SHARED_SUFFIX">
391 <if cond=
"WX_SHARED=='0'">lib
</if>
392 <if cond=
"WX_SHARED=='1'">dll
</if>
395 $(value)/$(COMPILER)_$(_DIRNAME_SHARED_SUFFIX)
398 <dirname>$(_DIRNAME)
</dirname>
400 <if cond=
"FORMAT_SUPPORTS_ACTIONS=='1'">
401 <set var=
"__mkdir_tgt">make_dir_$(id)
</set>
403 <add-target target=
"$(__mkdir_tgt)" type=
"action"/>
404 <modify-target target=
"$(__mkdir_tgt)">
405 <command cond=
"TOOLSET=='unix'">
406 @mkdir -p $(_DIRNAME)
408 <command cond=
"TOOLSET in ['win32','os2','dos']">
409 if not exist $(nativePaths(_DIRNAME)) mkdir $(nativePaths(_DIRNAME))
413 <!-- the following code is mostly equivalent to a:
414 <dependency-of>$(id)</dependency-of>
415 put into the __mkdir_tgt target, except that it does _prepend_
416 the __mkdir_tgt dependency instead of appending it.
418 This is required because some compilers (e.g. MSVC) need to store in the
419 output folder some files (e.g. the PDB file) while compiling and thus
420 the library output folder must have been created before _any_ source file
421 is compiled, not just before the library is linked.
423 <modify-target target=
"$(id)">
424 <set var=
"__deps" prepend=
"1">
425 $(substitute(__mkdir_tgt, lambda x: ref('__depname', x), 'DEP'))
430 <if cond=
"FORMAT=='autoconf'">
431 <set var=
"_DIRNAME">$(value)
</set>
432 <dirname>$(_DIRNAME)
</dirname>
436 <!-- Adds to the compiler & linker flags the path for the "include" and the
437 "lib" folders of a library following wxWidgets conventions which is
440 <define-tag name=
"wxlike-paths" rules=
"exe,lib,dll,module">
441 <if cond=
"FORMAT!='autoconf' and FORMAT!='gnu'">
442 <!-- WXLIBPATH is a path like "/lib/vc_lib"
443 NOTE: even if this template is going to be used for a "lib"
444 target (which does not uses lib-paths at all), we can still
445 use the <lib-path> target: it will just be discarded
447 <lib-path>$(value)$(WXLIBPATH)
</lib-path>
449 <!-- no special include paths for a lib following wxWidgets naming
451 <include>$(value)/include
</include>
454 <!-- for autoconf format the user should use CPPFLAGS and LDFLAGS to
455 specify non-system paths since the wx-based library should have
456 been installed in standard paths
462 <!-- UTILITY GLOBAL TAGS -->
465 <!-- Sets the BUILDDIR variable using the same rules used by wxWidgets itself.
466 This makes it possible to keep separed the object files compiled with
467 different configuration settings.
469 <define-global-tag name=
"set-wxlike-builddir">
470 <!-- note that the builddir for autoconf should always be '.' -->
471 <if cond=
"FORMAT!='autoconf'">
472 <set var=
"_BUILDDIR_SHARED_SUFFIX">
473 <if cond=
"WX_SHARED=='0'"></if>
474 <if cond=
"WX_SHARED=='1'">_dll
</if>
478 $(COMPILER)$(WX_PORT)$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)
483 <!-- Sets a variable with the name of the 'var' attribute value using the
484 same rules used for wxWidgets library naming.
487 <set-wxlike var='MYMODULE_LIBNAME' prefix='mylib'>
491 This tag also supports a 'cond' attribute making it very powerful
492 for conditional linking a wx-based library:
494 <option name="USE_MYMODULE">
497 <set-wxlike var='MYMODULE_DEP'
499 cond="USE_MYMODULE=='1'">
504 <sys-lib>$(MYMODULE_DEP)</sys-lib>
507 <define-global-tag name=
"set-wxlike">
508 <if cond=
"FORMAT!='autoconf' and FORMAT!='gnu'">
509 <if cond=
"'cond' not in attributes">
510 <set var=
"$(attributes['var'])">
511 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
514 <if cond=
"'cond' in attributes">
515 <set var=
"$(attributes['var'])">
516 <if cond=
"$(attributes['cond'])">
517 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
523 <if cond=
"FORMAT=='autoconf' or FORMAT=='gnu'">
524 <if cond=
"'cond' not in attributes">
525 <set var=
"$(attributes['var'])">
526 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
529 <if cond=
"'cond' in attributes">
530 <set var=
"$(attributes['var'])">
531 <if cond=
"$(attributes['cond'])">
532 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
540 <include file=
"wx_xrc.bkl"/>