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