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