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>
95 <wx-lib>media</wx-lib>
100 <wx-lib>base</wx-lib>
107 <requires version=
"0.2.2"/>
110 <!-- this variable identifies the version of the wx presets.
111 this is changed only when major changes to wxpresets take place.
113 <set var=
"WX_PRESETS_VERSION">4</set>
115 <!-- list of known libraries used by wx-lib tag defined in wx_unix.bkl and wx_win32.bkl
116 VERY IMPORTANT: when updating this list also update the <wx-lib> and <wx-all-libs>
119 <set var=
"WX_LIB_LIST">
120 base core net xml xrc html adv media gl qa aui richtext stc
123 <!-- if you define this variable to 0 before including wx presets, the
124 "test_for_selected_wxbuild" target which is added by default in win32 and GNU
125 makefiles, won't be added.
126 This is useful when e.g. you want to have wxWidgets as an optional
127 dependency and thus you don't want to perform that check unconditionally.
129 <set var=
"WX_TEST_FOR_SELECTED_WXBUILD" overwrite=
"0">
133 <!-- this is a temporary variable until there is non general -->
134 <!-- function in bakefiles for returning native markup for -->
135 <!-- reading envrionment variables -->
137 <if cond=
"FORMAT=='watcom'">%
</if>
138 <if cond=
"FORMAT!='watcom'"></if>
145 <!-- These are essentially the configurations you -->
146 <!-- want in bakefile. -->
148 <!-- In MSVC these are the different build -->
149 <!-- configurations you can have (in the build menu), -->
150 <!-- and in autoconf is enabled with enable-xxx=xx. -->
151 <!-- For other compilers a separate configuration -->
152 <!-- file is created (such as config.gcc on gcc) -->
153 <!-- which has several options a user can modify. -->
155 <!-- Note that the above only happens if an option -->
156 <!-- is not constant, i.e. if it cannot be determined -->
157 <!-- by bakefile itself. -->
158 <!-- Also note that for 'autoconf' format these options -->
159 <!-- are only useful when used together with wxpresets.m4 -->
160 <!-- macro file which contains macros for detecting the -->
161 <!-- option values for wx-based projects. See wxpresets.m4 -->
162 <!-- comments for more info. -->
165 <!-- Presets for limited dmars make.exe format: -->
166 <if cond=
"FORMAT=='dmars'">
167 <set var=
"WX_UNICODE">0</set>
168 <set var=
"WX_DEBUG">1</set>
169 <set var=
"WX_SHARED">0</set>
172 <!-- 'gnu' format needs to redefine the following options later in wx_unix.bkl -->
173 <if cond=
"FORMAT=='gnu'">
174 <set var=
"WX_UNICODE"/>
175 <set var=
"WX_DEBUG"/>
176 <set var=
"WX_SHARED"/>
178 <set var=
"WX_VERSION"/>
182 <!-- This is a standard option that determines -->
183 <!-- whether the user wants to build this library as -->
184 <!-- a dll or as a static library. -->
185 <if cond=
"not isdefined('WX_SHARED')">
186 <set var=
"WX_SHARED_DEFAULT" overwrite=
"0">0</set>
187 <option name=
"WX_SHARED">
189 <values-description>Static,DLL
</values-description>
190 <default-value>$(WX_SHARED_DEFAULT)
</default-value>
192 Use DLL build of wx library?
197 <!-- Configuration for building the bakefile with -->
198 <!-- unicode strings or not (unicode or ansi). -->
199 <if cond=
"not isdefined('WX_UNICODE')">
200 <set var=
"WX_UNICODE_DEFAULT" overwrite=
"0">0</set>
201 <option name=
"WX_UNICODE">
203 <values-description>ANSI,Unicode
</values-description>
204 <default-value>$(WX_UNICODE_DEFAULT)
</default-value>
206 Use Unicode build of wxWidgets?
211 <if cond=
"not isdefined('WX_DEBUG')">
212 <set var=
"WX_DEBUG_DEFAULT" overwrite=
"0">1</set>
213 <option name=
"WX_DEBUG">
215 <values-description>Release,Debug
</values-description>
216 <default-value>$(WX_DEBUG_DEFAULT)
</default-value>
218 Use debug build of wxWidgets (define __WXDEBUG__)?
223 <if cond=
"not isdefined('WX_VERSION')">
224 <set var=
"WX_VERSION_DEFAULT" overwrite=
"0">29</set>
225 <option name=
"WX_VERSION">
226 <default-value>$(WX_VERSION_DEFAULT)
</default-value>
228 Version of the wx library to build against.
233 <if cond=
"not isdefined('WX_MONOLITHIC')">
234 <set var=
"WX_MONOLITHIC_DEFAULT" overwrite=
"0">0</set>
235 <option name=
"WX_MONOLITHIC">
237 <values-description>Multilib,Monolithic
</values-description>
238 <default-value>$(WX_MONOLITHIC_DEFAULT)
</default-value>
240 Use monolithic build of wxWidgets?
245 <!-- The directory where wxWidgets is installed: -->
246 <if cond=
"not isdefined('WX_DIR')">
247 <set var=
"WX_DIR_DEFAULT" overwrite=
"0">$(DOLLAR)($(ENV_VAR)WXWIN)
</set>
248 <option name=
"WX_DIR" category=
"path" never_empty=
"1">
249 <default-value>$(WX_DIR_DEFAULT)
</default-value>
251 The directory where wxWidgets library is installed
258 <!-- HELPER VARIABLES -->
261 <!-- These are handy ways of dealing with the -->
262 <!-- extensions in the library names of the -->
263 <!-- wxWindows library. -->
264 <set var=
"WXLIBPOSTFIX">
265 <if cond=
"WX_DEBUG=='1' and WX_UNICODE=='1'">ud
</if>
266 <if cond=
"WX_DEBUG=='1' and WX_UNICODE=='0'">d
</if>
267 <if cond=
"WX_DEBUG=='0' and WX_UNICODE=='1'">u
</if>
273 <!-- REAL IMPLEMENTATION -->
276 <set var=
"__wx_included_impl">0</set>
278 <if cond=
"FORMAT in ['autoconf','gnu']">
279 <include file=
"wx_unix.bkl"/>
280 <set var=
"__wx_included_impl">1</set>
283 <if cond=
"FORMAT!='autoconf' and PLATFORM_WIN32=='1'">
284 <include file=
"wx_win32.bkl"/>
285 <set var=
"__wx_included_impl">1</set>
288 <if cond=
"FORMAT=='xcode2'">
289 <!-- xCode2 is an IDE and thus reuses almost nothing from unix part of wxpresets;
290 better use the win32 part! -->
291 <include file=
"wx_win32.bkl"/>
292 <set var=
"__wx_included_impl">1</set>
295 <if cond=
"__wx_included_impl=='0'">
296 <error>This format is not (yet) supported by wx preset.
</error>
302 <!-- HIGH-LEVEL TEMPLATE -->
305 <!-- Combine 'wxlike' with 'wx' or 'wx-lib' templates to have your
306 project build in the same configuration used by the selected
308 <template id=
"wxlike">
309 <!-- WX_DEBUG-dependent -->
311 <if cond=
"WX_DEBUG=='1'">off
</if>
312 <if cond=
"WX_DEBUG=='0'">speed
</if>
314 <set var=
"_DEBUGINFO">
315 <if cond=
"WX_DEBUG=='1'">on
</if>
316 <if cond=
"WX_DEBUG=='0'">off
</if>
319 <if cond=
"FORMAT!='autoconf'">
320 <optimize>$(_OPT)
</optimize>
321 <debug-info>$(_DEBUGINFO)
</debug-info>
325 <!-- Template for building wx-based GUI applications -->
326 <template id=
"wxgui" template=
"wx">
327 <app-type>gui
</app-type>
330 <!-- Template for building wx-based console applications -->
331 <template id=
"wxconsole" template=
"wx">
332 <app-type>console
</app-type>
337 <!-- UTILITY TAGS -->
340 <!-- private helper tag: does the same thing as for <set-wxlike> except that:
341 - the variable created is always named "__temp"
342 - can be used (only) inside targets as this is a non-global tag
344 <define-tag name=
"__setlibname" rules=
"lib,dll,module,exe">
346 <if cond=
"FORMAT!='autoconf' and FORMAT!='gnu'">
347 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
349 <if cond=
"FORMAT=='autoconf' or FORMAT=='gnu'">
350 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
355 <!-- A simple tag which helps you to define a library name using the same rules used
356 by wxWidgets. Use the 'prefix' attribute to add your lib's prefix.
358 <wxlike-libname prefix='mylib'>module1</wxlike-libname>
359 <wxlike-libname prefix='mylib'>module2</wxlike-libname>
361 <define-tag name=
"wxlike-libname" rules=
"lib">
362 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
363 <libname>$(__temp)
</libname>
366 <!-- exactly like <wxlike-libname> but this one sets the DLL name (and the DLL lib import name)
367 and thus must be used only inside a <dll> target...
369 <define-tag name=
"wxlike-dllname" rules=
"dll,module">
370 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
371 <libname>$(__temp)
</libname>
372 <dllname>$(__temp)
</dllname>
375 <!-- Links against a library which uses the same wxWidgets conventions.
377 <define-tag name=
"wxlike-lib" rules=
"exe,lib,dll,module">
378 <__setlibname prefix=
"$(attributes['prefix'])">$(value)
</__setlibname>
379 <sys-lib>$(__temp)
</sys-lib>
382 <!-- Sets as output folder for the current target a directory
383 called "$(value)/$(COMPILER)_lib|dll", just like wxWidgets does.
384 This makes it possible to keep separed the libraries/exes compiled with
385 different compilers and with a different value for WX_SHARED.
387 <define-tag name=
"wxlike-dirname" rules=
"lib,dll,exe,module">
388 <if cond=
"FORMAT!='autoconf'">
389 <set var=
"_DIRNAME_SHARED_SUFFIX">
390 <if cond=
"WX_SHARED=='0'">lib
</if>
391 <if cond=
"WX_SHARED=='1'">dll
</if>
394 $(value)/$(COMPILER)_$(_DIRNAME_SHARED_SUFFIX)
397 <dirname>$(_DIRNAME)
</dirname>
399 <if cond=
"FORMAT_SUPPORTS_ACTIONS=='1'">
400 <set var=
"__mkdir_tgt">make_dir_$(id)
</set>
402 <add-target target=
"$(__mkdir_tgt)" type=
"action"/>
403 <modify-target target=
"$(__mkdir_tgt)">
404 <command cond=
"TOOLSET=='unix'">
405 @mkdir -p $(_DIRNAME)
407 <command cond=
"TOOLSET in ['win32','os2','dos']">
408 if not exist $(nativePaths(_DIRNAME)) mkdir $(nativePaths(_DIRNAME))
412 <!-- the following code is mostly equivalent to a:
413 <dependency-of>$(id)</dependency-of>
414 put into the __mkdir_tgt target, except that it does _prepend_
415 the __mkdir_tgt dependency instead of appending it.
417 This is required because some compilers (e.g. MSVC) need to store in the
418 output folder some files (e.g. the PDB file) while compiling and thus
419 the library output folder must have been created before _any_ source file
420 is compiled, not just before the library is linked.
422 <modify-target target=
"$(id)">
423 <set var=
"__deps" prepend=
"1">
424 $(substitute(__mkdir_tgt, lambda x: ref('__depname', x), 'DEP'))
429 <if cond=
"FORMAT=='autoconf'">
430 <set var=
"_DIRNAME">$(value)
</set>
431 <dirname>$(_DIRNAME)
</dirname>
435 <!-- Adds to the compiler & linker flags the path for the "include" and the
436 "lib" folders of a library following wxWidgets conventions which is
439 <define-tag name=
"wxlike-paths" rules=
"exe,lib,dll,module">
440 <if cond=
"FORMAT!='autoconf' and FORMAT!='gnu'">
441 <!-- WXLIBPATH is a path like "/lib/vc_lib"
442 NOTE: even if this template is going to be used for a "lib"
443 target (which does not uses lib-paths at all), we can still
444 use the <lib-path> target: it will just be discarded
446 <lib-path>$(value)$(WXLIBPATH)
</lib-path>
448 <!-- no special include paths for a lib following wxWidgets naming
450 <include>$(value)/include
</include>
453 <!-- for autoconf format the user should use CPPFLAGS and LDFLAGS to
454 specify non-system paths since the wx-based library should have
455 been installed in standard paths
461 <!-- UTILITY GLOBAL TAGS -->
464 <!-- Sets the BUILDDIR variable using the same rules used by wxWidgets itself.
465 This makes it possible to keep separed the object files compiled with
466 different configuration settings.
468 <define-global-tag name=
"set-wxlike-builddir">
469 <!-- note that the builddir for autoconf should always be '.' -->
470 <if cond=
"FORMAT!='autoconf'">
471 <set var=
"_BUILDDIR_SHARED_SUFFIX">
472 <if cond=
"WX_SHARED=='0'"></if>
473 <if cond=
"WX_SHARED=='1'">_dll
</if>
477 $(COMPILER)$(WX_PORT)$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)
482 <!-- Sets a variable with the name of the 'var' attribute value using the
483 same rules used for wxWidgets library naming.
486 <set-wxlike var='MYMODULE_LIBNAME' prefix='mylib'>
490 This tag also supports a 'cond' attribute making it very powerful
491 for conditional linking a wx-based library:
493 <option name="USE_MYMODULE">
496 <set-wxlike var='MYMODULE_DEP'
498 cond="USE_MYMODULE=='1'">
503 <sys-lib>$(MYMODULE_DEP)</sys-lib>
506 <define-global-tag name=
"set-wxlike">
507 <if cond=
"FORMAT!='autoconf' and FORMAT!='gnu'">
508 <if cond=
"'cond' not in attributes">
509 <set var=
"$(attributes['var'])">
510 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
513 <if cond=
"'cond' in attributes">
514 <set var=
"$(attributes['var'])">
515 <if cond=
"$(attributes['cond'])">
516 $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
522 <if cond=
"FORMAT=='autoconf' or FORMAT=='gnu'">
523 <if cond=
"'cond' not in attributes">
524 <set var=
"$(attributes['var'])">
525 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
528 <if cond=
"'cond' in attributes">
529 <set var=
"$(attributes['var'])">
530 <if cond=
"$(attributes['cond'])">
531 $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)