4 <!-- Original source: http://wiki.wxwidgets.org/wiki.pl?Bakefile -->
5 <!-- Modified by: Francesco Montorsi <frm@users.sourceforge.net> -->
6 <!-- Vaclav Slavik <vslavik@fastmail.fm> to better fit
7 into Bakefile's presets -->
8 <!-- Creation date: 6/9/2004 -->
9 <!-- Last revision: 22/1/2005 off-CVS -->
18 <!-- These are essentially the configurations you -->
19 <!-- want in bakefile. -->
21 <!-- In MSVC these are the different build -->
22 <!-- configurations you can have (in the build menu), -->
23 <!-- and in autoconf is enabled with enable-xxx=xx. -->
24 <!-- For other compilers a separate configuration -->
25 <!-- file is created (such as config.gcc on gcc) -->
26 <!-- which has several options a user can modify. -->
28 <!-- Note that the above only happens if an option -->
29 <!-- is not constant, i.e. if it cannot be determined -->
30 <!-- by bakefile itself. -->
31 <!-- Also note that for 'autoconf' format these options -->
32 <!-- are only useful when used together with wxpresets.m4 -->
33 <!-- macro file which contains macros for detecting the -->
34 <!-- option values for wx-based projects. See wxpresets.m4 -->
35 <!-- comments for more info. -->
39 <!-- HELPER VARIABLES -->
43 <!-- The unicode define we want. By default bakefile -->
44 <!-- makes variables an empty string, so if unicode -->
45 <!-- is not defined $(UNICODE_DEFINE) would expand -->
46 <!-- to nothing (literally). -->
47 <set var=
"WXUNICODE_DEFINE">
48 <if cond=
"WX_UNICODE=='1'">_UNICODE
</if>
51 <!-- The debug define we need with win32 compilers -->
52 <!-- (on Linux, the wx-config program is used). -->
53 <set var=
"WXDEBUG_DEFINE">
54 <if cond=
"WX_DEBUG=='1'">__WXDEBUG__
</if>
57 <!-- These are handy ways of dealing with the -->
58 <!-- extensions in the library names of the -->
59 <!-- wxWindows library. -->
60 <set var=
"WX3RDPARTYLIBPOSTFIX">
61 <if cond=
"WX_DEBUG=='1'">d
</if>
65 <if cond=
"FORMAT=='msevc4prj'">_$(CPU)
</if>
69 <if cond=
"WX_SHARED=='0'">$(DIRSEP)lib$(DIRSEP)$(COMPILER_PREFIX)$(WXCPU)_lib
</if>
70 <if cond=
"WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER_PREFIX)$(WXCPU)_dll
</if>
73 <!-- under Unix this is an option (detected at configure-time);
74 under Windows this is not an user option! -->
76 <if cond=
"FORMAT=='msevc4prj'">wince
</if>
77 <if cond=
"FORMAT!='msevc4prj'">msw
</if>
80 <set var=
"WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WX_PORT)$(WXLIBPOSTFIX)
</set>
83 <!-- All the possible mixes for the wx library names -->
84 <set var=
"WXLIB_BASE_NAME">
85 <if cond=
"WX_MONOLITHIC=='0'">wxbase$(WX_VERSION)$(WXLIBPOSTFIX)
</if>
88 the trick used to support monolithic builds is here: when the
89 <wx-lib>base</wx-lib> tag is found, and user selected
90 WX_MONOLITHIC=1, then the base library is translated to the
93 <if cond=
"WX_MONOLITHIC=='1'">wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)
</if>
97 <!-- Libraries whose name is prefixed with 'wxbase' -->
98 <define-global-tag name=
"define-wxbase-lib-name">
99 <set var=
"WXLIB_$(value.upper())_NAME">
100 <if cond=
"WX_MONOLITHIC=='0'">
101 wxbase$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
106 <define-wxbase-lib-name>net
</define-wxbase-lib-name>
107 <define-wxbase-lib-name>xml
</define-wxbase-lib-name>
110 <!-- Libraries whose name is prefixed with 'wx' only -->
111 <define-global-tag name=
"define-wxlib-name">
112 <set var=
"WXLIB_$(value.upper())_NAME">
113 <if cond=
"WX_MONOLITHIC=='0'">
114 wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
119 <define-wxlib-name>core
</define-wxlib-name>
120 <define-wxlib-name>media
</define-wxlib-name>
121 <define-wxlib-name>xrc
</define-wxlib-name>
122 <define-wxlib-name>html
</define-wxlib-name>
123 <define-wxlib-name>adv
</define-wxlib-name>
124 <define-wxlib-name>qa
</define-wxlib-name>
125 <define-wxlib-name>aui
</define-wxlib-name>
126 <define-wxlib-name>ribbon
</define-wxlib-name>
127 <define-wxlib-name>propgrid
</define-wxlib-name>
128 <define-wxlib-name>stc
</define-wxlib-name>
129 <define-wxlib-name>richtext
</define-wxlib-name>
131 <!-- NOTE: The GL lib is not part of the monolithic build; treat it as a contrib! -->
138 <!-- While not required, templates make your -->
139 <!-- bakefiles much more readable. Templates, in -->
140 <!-- essence, are abstract classes like c++. -->
142 <!-- Your build targets "inherit" the template, -->
143 <!-- along with the info associated with the template -->
146 <!-- wxWidgets LIBRARY/APP TEMPLATE -->
148 <!-- The "base class" of all our build targets -->
149 <!-- This links with the appropriate native -->
150 <!-- libraries required by the platform, the libraries -->
151 <!-- we want for our stuff, and the wxWindows libs. -->
153 <!-- this tag is used to include wx libraries: -->
154 <define-tag name=
"wx-lib" rules=
"exe,dll,module">
155 <if cond=
"value=='base'"><sys-lib>$(WXLIB_BASE_NAME)
</sys-lib></if>
156 <if cond=
"value=='core'"><sys-lib>$(WXLIB_CORE_NAME)
</sys-lib></if>
158 <if cond=
"value=='net'"><sys-lib>$(WXLIB_NET_NAME)
</sys-lib></if>
159 <if cond=
"value=='xml'"><sys-lib>$(WXLIB_XML_NAME)
</sys-lib></if>
161 <if cond=
"value=='media'"><sys-lib>$(WXLIB_MEDIA_NAME)
</sys-lib></if>
162 <if cond=
"value=='xrc'"><sys-lib>$(WXLIB_XRC_NAME)
</sys-lib></if>
163 <if cond=
"value=='html'"><sys-lib>$(WXLIB_HTML_NAME)
</sys-lib></if>
164 <if cond=
"value=='adv'"><sys-lib>$(WXLIB_ADV_NAME)
</sys-lib></if>
165 <if cond=
"value=='qa'"><sys-lib>$(WXLIB_QA_NAME)
</sys-lib></if>
166 <if cond=
"value=='aui'"><sys-lib>$(WXLIB_AUI_NAME)
</sys-lib></if>
167 <if cond=
"value=='ribbon'"><sys-lib>$(WXLIB_RIBBON_NAME)
</sys-lib></if>
168 <if cond=
"value=='propgrid'"><sys-lib>$(WXLIB_PROPGRID_NAME)
</sys-lib></if>
169 <if cond=
"value=='richtext'"><sys-lib>$(WXLIB_RICHTEXT_NAME)
</sys-lib></if>
171 <!-- The GL lib isn't part of the monolithic build, treat it as a contrib: -->
172 <if cond=
"value=='gl'">
173 <sys-lib>wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
</sys-lib>
176 <if cond=
"value=='stc'">
177 <!-- wxSTC requires also the basic scintilla library
178 which is built as a separate 3rd party library -->
179 <sys-lib>$(WXLIB_STC_NAME)
</sys-lib>
180 <sys-lib>wxscintilla$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
183 <if cond=
"value not in WX_LIB_LIST.split()">
184 <error>Unknown wxWidgets library given in the wx-lib tag
</error>
188 <!-- just a placeholder to mark the place where <wx-lib> will be placed,
189 thanks to the order precedence declaration below it: -->
190 <define-tag name=
"__wx-libs-point" rules=
"exe,dll,module"/>
191 <tag-info name=
"wx-lib"
192 position=
"before:__wx-libs-point"/>
193 <tag-info name=
"__wx-syslibs"
194 position=
"after:__wx-libs-point"/>
197 <!-- template for static wx libraries: -->
198 <template id=
"wx-lib">
199 <!-- MISCELLANEOUS -->
200 <if cond=
"FORMAT=='mingw'">
201 <define>HAVE_W32API_H
</define>
202 <ldflags>-mthreads
</ldflags>
205 <define>$(substituteFromDict(WX_SHARED,{'
1':'WXUSINGDLL','
0':''}))
</define>
207 <define>$(WXUNICODE_DEFINE)
</define>
208 <define>$(WXDEBUG_DEFINE)
</define>
209 <define>__WXMSW__
</define>
211 <if cond=
"FORMAT!='xcode2'">
212 <include>$(WX_DIR)$(WXLIBINCLUDE)
</include>
213 <include>$(WX_DIR)/include
</include>
218 <!-- this ugly tag contains all sys-lib tags used by "wx" template,
219 in order to make sure they are not reorder when wx-lib is moved
220 after __wx-libs-point: -->
221 <define-tag name=
"__wx-syslibs" rules=
"exe,dll,module">
222 <!-- wx 3rd party libs, always use them: -->
223 <sys-lib cond=
"FORMAT!='msevc4prj'">wxtiff$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
224 <sys-lib>wxjpeg$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
225 <sys-lib>wxpng$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
226 <sys-lib>wxzlib$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
227 <!-- For regex we won't use the WX3RDPARTYLIBPOSTIX postfix:
228 unliked tiff, jpeg, png, zlib, expat, when building
229 in Unicode mode, the "u" suffix is appended to regex -->
230 <sys-lib cond=
"FORMAT!='msevc4prj'">wxregex$(WXLIBPOSTFIX)
</sys-lib>
231 <sys-lib>wxexpat$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
233 <!-- link-in system libs that wx depends on: -->
234 <!-- If on borland, we don't need to do much -->
235 <if cond=
"FORMAT=='borland'">
236 <sys-lib>ole2w32
</sys-lib>
239 <!-- Non-borland, on the other hand... -->
240 <if cond=
"FORMAT not in ['borland','msevc4prj']">
241 <sys-lib>kernel32
</sys-lib>
242 <sys-lib>user32
</sys-lib>
243 <sys-lib>gdi32
</sys-lib>
244 <sys-lib>comdlg32
</sys-lib>
245 <sys-lib>winspool
</sys-lib>
246 <sys-lib>winmm
</sys-lib>
247 <sys-lib>shell32
</sys-lib>
248 <sys-lib>comctl32
</sys-lib>
249 <sys-lib>ole32
</sys-lib>
250 <sys-lib>oleaut32
</sys-lib>
251 <sys-lib>uuid
</sys-lib>
252 <sys-lib>rpcrt4
</sys-lib>
253 <sys-lib>advapi32
</sys-lib>
254 <sys-lib>wsock32
</sys-lib>
257 <!-- Libs common to both borland and MSVC -->
258 <if cond=
"FORMAT=='msvc' or FORMAT=='msvc6prj' or FORMAT=='borland'">
259 <sys-lib>oleacc
</sys-lib>
263 <!-- template for wx executables/dlls: -->
264 <template id=
"wx" template=
"wx-lib">
265 <if cond=
"FORMAT!='xcode2'">
266 <lib-path>$(WX_DIR)$(WXLIBPATH)
</lib-path>
269 <!-- wx libs must come before 3rd party and sys libs, this is
270 the place where the hack explained above is carried on: -->
275 <if cond=
"FORMAT_SUPPORTS_ACTIONS=='1' and WX_TEST_FOR_SELECTED_WXBUILD=='1'">
278 VERY IMPORTANT: before starting to build all targets of the generated makefile,
279 we need to check if the selected wxWidgets build exists; we do
280 that simply creating the following target; if it fails the make
281 program will halt printing the following nice error message...
282 (much better than the 'could not find wx/*.h file')
284 <action id=
"test_for_selected_wxbuild">
285 <dependency-of>all
</dependency-of>
287 <!-- the @ is to hide these actions from the user -->
289 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
290 echo ----------------------------------------------------------------------------
291 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
292 echo The selected wxWidgets build is not available!
293 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
294 echo Please use the options prefixed with WX_ to select another wxWidgets build.
295 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
296 echo ----------------------------------------------------------------------------
297 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \