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