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