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