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