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