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)$(WXCPU)_lib
</if>
70 <if cond=
"WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER)$(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' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)
</if>
86 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d
</if>
87 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u
</if>
88 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud
</if>
91 the trick used to support monolithic builds is here: when the
92 <wx-lib>base</wx-lib> tag is found, and user selected
93 WX_MONOLITHIC=1, then the base library is translated to the
96 <if cond=
"WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WX_PORT)$(WX_VERSION)
</if>
97 <if cond=
"WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WX_PORT)$(WX_VERSION)d
</if>
98 <if cond=
"WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WX_PORT)$(WX_VERSION)u
</if>
99 <if cond=
"WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WX_PORT)$(WX_VERSION)ud
</if>
103 <!-- Libraries whose name is prefixed with 'wxbase' -->
104 <define-global-tag name=
"define-wxbase-lib-name">
105 <set var=
"WXLIB_$(value.upper())_NAME">
106 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">
107 wxbase$(WX_VERSION)_$(value)
109 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">
110 wxbase$(WX_VERSION)d_$(value)
112 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">
113 wxbase$(WX_VERSION)u_$(value)
115 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">
116 wxbase$(WX_VERSION)ud_$(value)
121 <define-wxbase-lib-name>net
</define-wxbase-lib-name>
122 <define-wxbase-lib-name>xml
</define-wxbase-lib-name>
123 <define-wxbase-lib-name>odbc
</define-wxbase-lib-name>
126 <!-- Libraries whose name is prefixed with 'wx' only -->
127 <define-global-tag name=
"define-wxlib-name">
128 <set var=
"WXLIB_$(value.upper())_NAME">
129 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">
130 wx$(WX_PORT)$(WX_VERSION)_$(value)
132 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">
133 wx$(WX_PORT)$(WX_VERSION)d_$(value)
135 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">
136 wx$(WX_PORT)$(WX_VERSION)u_$(value)
138 <if cond=
"WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">
139 wx$(WX_PORT)$(WX_VERSION)ud_$(value)
144 <define-wxlib-name>core
</define-wxlib-name>
145 <define-wxlib-name>media
</define-wxlib-name>
146 <define-wxlib-name>xrc
</define-wxlib-name>
147 <define-wxlib-name>html
</define-wxlib-name>
148 <define-wxlib-name>adv
</define-wxlib-name>
149 <define-wxlib-name>qa
</define-wxlib-name>
150 <define-wxlib-name>dbgrid
</define-wxlib-name>
151 <define-wxlib-name>gl
</define-wxlib-name>
152 <define-wxlib-name>aui
</define-wxlib-name>
153 <define-wxlib-name>stc
</define-wxlib-name>
154 <define-wxlib-name>richtext
</define-wxlib-name>
163 <!-- While not required, templates make your -->
164 <!-- bakefiles much more readable. Templates, in -->
165 <!-- essence, are abstract classes like c++. -->
167 <!-- Your build targets "inherit" the template, -->
168 <!-- along with the info associated with the template -->
171 <!-- wxWidgets LIBRARY/APP TEMPLATE -->
173 <!-- The "base class" of all our build targets -->
174 <!-- This links with the appropriate native -->
175 <!-- libraries required by the platform, the libraries -->
176 <!-- we want for our stuff, and the wxWindows libs. -->
178 <!-- this tag is used to include wx libraries: -->
179 <define-tag name=
"wx-lib" rules=
"exe,dll,module">
180 <if cond=
"value=='base'"><sys-lib>$(WXLIB_BASE_NAME)
</sys-lib></if>
181 <if cond=
"value=='core'"><sys-lib>$(WXLIB_CORE_NAME)
</sys-lib></if>
183 <if cond=
"value=='net'"><sys-lib>$(WXLIB_NET_NAME)
</sys-lib></if>
184 <if cond=
"value=='xml'"><sys-lib>$(WXLIB_XML_NAME)
</sys-lib></if>
185 <if cond=
"value=='odbc'"><sys-lib>$(WXLIB_ODBC_NAME)
</sys-lib></if>
187 <if cond=
"value=='media'"><sys-lib>$(WXLIB_MEDIA_NAME)
</sys-lib></if>
188 <if cond=
"value=='xrc'"><sys-lib>$(WXLIB_XRC_NAME)
</sys-lib></if>
189 <if cond=
"value=='html'"><sys-lib>$(WXLIB_HTML_NAME)
</sys-lib></if>
190 <if cond=
"value=='adv'"><sys-lib>$(WXLIB_ADV_NAME)
</sys-lib></if>
191 <if cond=
"value=='gl'"><sys-lib>$(WXLIB_GL_NAME)
</sys-lib></if>
192 <if cond=
"value=='dbgrid'"><sys-lib>$(WXLIB_DBGRID_NAME)
</sys-lib></if>
193 <if cond=
"value=='qa'"><sys-lib>$(WXLIB_QA_NAME)
</sys-lib></if>
194 <if cond=
"value=='aui'"><sys-lib>$(WXLIB_AUI_NAME)
</sys-lib></if>
195 <if cond=
"value=='richtext'"><sys-lib>$(WXLIB_RICHTEXT_NAME)
</sys-lib></if>
197 <if cond=
"value=='stc'">
198 <!-- wxSTC requires also the basic scintilla library
199 which is built as a separate 3rd party library -->
200 <sys-lib>$(WXLIB_STC_NAME)
</sys-lib>
201 <sys-lib>wxscintilla$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
204 <if cond=
"value not in WX_LIB_LIST.split()">
205 <error>Unknown wxWidgets library given in the wx-lib tag
</error>
209 <!-- just a placeholder to mark the place where <wx-lib> will be placed,
210 thanks to the order precedence declaration below it: -->
211 <define-tag name=
"__wx-libs-point" rules=
"exe,dll,module"/>
212 <tag-info name=
"wx-lib"
213 position=
"before:__wx-libs-point"/>
214 <tag-info name=
"__wx-syslibs"
215 position=
"after:__wx-libs-point"/>
218 <!-- template for static wx libraries: -->
219 <template id=
"wx-lib">
220 <!-- MISCELLANEOUS -->
221 <if cond=
"FORMAT=='mingw'">
222 <define>HAVE_W32API_H
</define>
223 <ldflags>-mthreads
</ldflags>
226 <define>$(substituteFromDict(WX_SHARED,{'
1':'WXUSINGDLL','
0':''}))
</define>
228 <define>$(WXUNICODE_DEFINE)
</define>
229 <define>$(WXDEBUG_DEFINE)
</define>
230 <define>__WXMSW__
</define>
232 <include>$(WX_DIR)$(WXLIBINCLUDE)
</include>
233 <include>$(WX_DIR)/include
</include>
237 <!-- this ugly tag contains all sys-lib tags used by "wx" template,
238 in order to make sure they are not reorder when wx-lib is moved
239 after __wx-libs-point: -->
240 <define-tag name=
"__wx-syslibs" rules=
"exe,dll,module">
241 <!-- wx 3rd party libs, always use them: -->
242 <sys-lib cond=
"FORMAT!='msevc4prj'">wxtiff$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
243 <sys-lib>wxjpeg$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
244 <sys-lib>wxpng$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
245 <sys-lib>wxzlib$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
246 <!-- For regex we won't use the WX3RDPARTYLIBPOSTIX postfix:
247 unliked tiff, jpeg, png, zlib, expat, when building
248 in Unicode mode, the "u" suffix is appended to regex -->
249 <sys-lib cond=
"FORMAT!='msevc4prj'">wxregex$(WXLIBPOSTFIX)
</sys-lib>
250 <sys-lib>wxexpat$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
252 <!-- link-in system libs that wx depends on: -->
253 <!-- If on borland, we don't need to do much -->
254 <if cond=
"FORMAT=='borland'">
255 <sys-lib>ole2w32
</sys-lib>
256 <sys-lib>odbc32
</sys-lib>
259 <!-- Non-borland, on the other hand... -->
260 <if cond=
"FORMAT not in ['borland','msevc4prj']">
261 <sys-lib>kernel32
</sys-lib>
262 <sys-lib>user32
</sys-lib>
263 <sys-lib>gdi32
</sys-lib>
264 <sys-lib>comdlg32
</sys-lib>
265 <sys-lib>winspool
</sys-lib>
266 <sys-lib>winmm
</sys-lib>
267 <sys-lib>shell32
</sys-lib>
268 <sys-lib>comctl32
</sys-lib>
269 <sys-lib>ole32
</sys-lib>
270 <sys-lib>oleaut32
</sys-lib>
271 <sys-lib>uuid
</sys-lib>
272 <sys-lib>rpcrt4
</sys-lib>
273 <sys-lib>advapi32
</sys-lib>
274 <sys-lib>wsock32
</sys-lib>
275 <sys-lib>odbc32
</sys-lib>
278 <!-- Libs common to both borland and MSVC -->
279 <if cond=
"FORMAT=='msvc' or FORMAT=='msvc6prj' or FORMAT=='borland'">
280 <sys-lib>oleacc
</sys-lib>
284 <!-- template for wx executables/dlls: -->
285 <template id=
"wx" template=
"wx-lib">
286 <lib-path>$(WX_DIR)$(WXLIBPATH)
</lib-path>
288 <!-- wx libs must come before 3rd party and sys libs, this is
289 the place where the hack explained above is carried on: -->
294 <if cond=
"FORMAT_SUPPORTS_ACTIONS=='1' and WX_TEST_FOR_SELECTED_WXBUILD=='1'">
297 VERY IMPORTANT: before starting to build all targets of the generated makefile,
298 we need to check if the selected wxWidgets build exists; we do
299 that simply creating the following target; if it fails the make
300 program will halt printing the following nice error message...
301 (much better than the 'could not find wx/*.h file')
303 <action id=
"test_for_selected_wxbuild">
304 <dependency-of>all
</dependency-of>
306 <!-- the @ is to hide these actions from the user -->
308 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
309 echo ----------------------------------------------------------------------------
310 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
311 echo The selected wxWidgets build is not available!
312 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
313 echo Please use the options prefixed with WX_ to select another wxWidgets build.
314 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
315 echo ----------------------------------------------------------------------------
316 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \