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 -->
20 <set var=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL">
21 <!-- 'NORMAL' here refers to the fact that the formats for which
22 FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL==1 only need
23 additional compiler and/or linker flags (see e.g. WXMACHINE_FLAG)
25 <if cond=
"FORMAT in ['msvc']">1</if>
26 <if cond=
"FORMAT not in ['msvc']">0</if>
28 <set var=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS">
29 <!-- the formats for which FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS==1
30 need special handling: see the docs of the MSVS_PLATFORMS variable in Bakefile docs.
32 <if cond=
"FORMAT in ['msvs2005prj','msvs2008prj']">1</if>
33 <if cond=
"FORMAT not in ['msvs2005prj','msvs2008prj']">0</if>
35 <set var=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES">
36 <if cond=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1'">1</if>
37 <if cond=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='1'">1</if>
38 <if cond=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='0' and FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='0'">0</if>
41 <!-- This is a standard option that determines -->
42 <!-- the architecture for which the lib/exe/dll later -->
43 <!-- declared are meant. -->
44 <if cond=
"not isdefined('TARGET_CPU') and FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1'">
45 <set var=
"TARGET_CPU_DEFAULT" overwrite=
"0">X86
</set>
46 <option name=
"TARGET_CPU">
47 <values>X86,AMD64,IA64
</values>
48 <values-description>i386-compatible,AMD
64 bit,Itanium
64 bit
</values-description>
49 <default-value>$(TARGET_CPU_DEFAULT)
</default-value>
51 Architecture of the CPU for which to build the executables and libraries
58 <!-- HELPER VARIABLES -->
62 <!-- The unicode define we want. By default bakefile -->
63 <!-- makes variables an empty string, so if unicode -->
64 <!-- is not defined $(UNICODE_DEFINE) would expand -->
65 <!-- to nothing (literally). -->
66 <set var=
"WXUNICODE_DEFINE">
67 <if cond=
"WX_UNICODE=='1'">_UNICODE
</if>
70 <!-- The debug define we need with win32 compilers -->
71 <!-- (on Linux, the wx-config program is used). -->
72 <set var=
"WXDEBUG_DEFINE">
73 <if cond=
"WX_DEBUG=='1'">__WXDEBUG__
</if>
76 <!-- These are handy ways of dealing with the -->
77 <!-- extensions in the library names of the -->
78 <!-- wxWindows library. -->
79 <set var=
"WX3RDPARTYLIBPOSTFIX">
80 <if cond=
"WX_DEBUG=='1'">d
</if>
84 <if cond=
"FORMAT=='msevc4prj'">_$(CPU)
</if>
86 <!-- just define the correct string for those formats which support the 'TARGET_CPU' option: -->
87 <if cond=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1' and TARGET_CPU=='AMD64'">_amd64
</if>
88 <if cond=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1' and TARGET_CPU=='IA64'">_ia64
</if>
90 <!-- for MSVS projects instead of the 'TARGET_CPU' option we need to use the 'MSVS_PLATFORM' variable: -->
91 <if cond=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='1' and MSVS_PLATFORM=='win64'">_amd64
</if>
94 <set var=
"WXMACHINE_FLAG">
95 <!-- add the /MACHINE linker flag to formats with "normal" multiple-arch support when building in 64bit mode: -->
96 <if cond=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1' and TARGET_CPU=='AMD64'">/MACHINE:AMD64
</if>
97 <if cond=
"FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1' and TARGET_CPU=='IA64'">/MACHINE:IA64
</if>
100 <set var=
"WXLIBPATH">
101 <if cond=
"WX_SHARED=='0'">$(DIRSEP)lib$(DIRSEP)$(COMPILER_PREFIX)$(WXCPU)_lib
</if>
102 <if cond=
"WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER_PREFIX)$(WXCPU)_dll
</if>
105 <!-- under Unix this is an option (detected at configure-time);
106 under Windows this is not an user option! -->
108 <if cond=
"FORMAT=='msevc4prj'">wince
</if>
109 <if cond=
"FORMAT!='msevc4prj'">msw
</if>
112 <set var=
"WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WX_PORT)$(WXLIBPOSTFIX)
</set>
115 <!-- All the possible mixes for the wx library names -->
116 <set var=
"WXLIB_BASE_NAME">
117 <if cond=
"WX_MONOLITHIC=='0'">wxbase$(WX_VERSION)$(WXLIBPOSTFIX)
</if>
120 the trick used to support monolithic builds is here: when the
121 <wx-lib>base</wx-lib> tag is found, and user selected
122 WX_MONOLITHIC=1, then the base library is translated to the
125 <if cond=
"WX_MONOLITHIC=='1'">wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)
</if>
129 <!-- Libraries whose name is prefixed with 'wxbase' -->
130 <define-global-tag name=
"define-wxbase-lib-name">
131 <set var=
"WXLIB_$(value.upper())_NAME">
132 <if cond=
"WX_MONOLITHIC=='0'">
133 wxbase$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
138 <define-wxbase-lib-name>net
</define-wxbase-lib-name>
139 <define-wxbase-lib-name>xml
</define-wxbase-lib-name>
142 <!-- Libraries whose name is prefixed with 'wx' only -->
143 <define-global-tag name=
"define-wxlib-name">
144 <set var=
"WXLIB_$(value.upper())_NAME">
145 <if cond=
"WX_MONOLITHIC=='0'">
146 wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
151 <define-wxlib-name>core
</define-wxlib-name>
152 <define-wxlib-name>media
</define-wxlib-name>
153 <define-wxlib-name>xrc
</define-wxlib-name>
154 <define-wxlib-name>html
</define-wxlib-name>
155 <define-wxlib-name>adv
</define-wxlib-name>
156 <define-wxlib-name>qa
</define-wxlib-name>
157 <define-wxlib-name>aui
</define-wxlib-name>
158 <define-wxlib-name>ribbon
</define-wxlib-name>
159 <define-wxlib-name>propgrid
</define-wxlib-name>
160 <define-wxlib-name>stc
</define-wxlib-name>
161 <define-wxlib-name>richtext
</define-wxlib-name>
163 <!-- NOTE: The GL lib is not part of the monolithic build; treat it as a contrib! -->
170 <!-- While not required, templates make your -->
171 <!-- bakefiles much more readable. Templates, in -->
172 <!-- essence, are abstract classes like c++. -->
174 <!-- Your build targets "inherit" the template, -->
175 <!-- along with the info associated with the template -->
178 <!-- wxWidgets LIBRARY/APP TEMPLATE -->
180 <!-- The "base class" of all our build targets -->
181 <!-- This links with the appropriate native -->
182 <!-- libraries required by the platform, the libraries -->
183 <!-- we want for our stuff, and the wxWindows libs. -->
185 <!-- this tag is used to include wx libraries: -->
186 <define-tag name=
"wx-lib" rules=
"exe,dll,module">
187 <if cond=
"value=='base'"><sys-lib>$(WXLIB_BASE_NAME)
</sys-lib></if>
188 <if cond=
"value=='core'"><sys-lib>$(WXLIB_CORE_NAME)
</sys-lib></if>
190 <if cond=
"value=='net'"><sys-lib>$(WXLIB_NET_NAME)
</sys-lib></if>
191 <if cond=
"value=='xml'"><sys-lib>$(WXLIB_XML_NAME)
</sys-lib></if>
193 <if cond=
"value=='media'"><sys-lib>$(WXLIB_MEDIA_NAME)
</sys-lib></if>
194 <if cond=
"value=='xrc'"><sys-lib>$(WXLIB_XRC_NAME)
</sys-lib></if>
195 <if cond=
"value=='html'"><sys-lib>$(WXLIB_HTML_NAME)
</sys-lib></if>
196 <if cond=
"value=='adv'"><sys-lib>$(WXLIB_ADV_NAME)
</sys-lib></if>
197 <if cond=
"value=='qa'"><sys-lib>$(WXLIB_QA_NAME)
</sys-lib></if>
198 <if cond=
"value=='aui'"><sys-lib>$(WXLIB_AUI_NAME)
</sys-lib></if>
199 <if cond=
"value=='ribbon'"><sys-lib>$(WXLIB_RIBBON_NAME)
</sys-lib></if>
200 <if cond=
"value=='propgrid'"><sys-lib>$(WXLIB_PROPGRID_NAME)
</sys-lib></if>
201 <if cond=
"value=='richtext'"><sys-lib>$(WXLIB_RICHTEXT_NAME)
</sys-lib></if>
203 <!-- The GL lib isn't part of the monolithic build, treat it as a contrib: -->
204 <if cond=
"value=='gl'">
205 <sys-lib>wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
</sys-lib>
208 <if cond=
"value=='stc'">
209 <!-- wxSTC requires also the basic scintilla library
210 which is built as a separate 3rd party library -->
211 <sys-lib>$(WXLIB_STC_NAME)
</sys-lib>
212 <sys-lib>wxscintilla$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
215 <if cond=
"value not in WX_LIB_LIST.split()">
216 <error>Unknown wxWidgets library given in the wx-lib tag
</error>
220 <!-- just a placeholder to mark the place where <wx-lib> will be placed,
221 thanks to the order precedence declaration below it: -->
222 <define-tag name=
"__wx-libs-point" rules=
"exe,dll,module"/>
223 <tag-info name=
"wx-lib"
224 position=
"before:__wx-libs-point"/>
225 <tag-info name=
"__wx-syslibs"
226 position=
"after:__wx-libs-point"/>
229 <!-- template for static wx libraries: -->
230 <template id=
"wx-lib">
231 <!-- MISCELLANEOUS -->
232 <if cond=
"FORMAT=='mingw'">
233 <define>HAVE_W32API_H
</define>
234 <ldflags>-mthreads
</ldflags>
237 <define>$(substituteFromDict(WX_SHARED,{'
1':'WXUSINGDLL','
0':''}))
</define>
239 <define>$(WXUNICODE_DEFINE)
</define>
240 <define>$(WXDEBUG_DEFINE)
</define>
241 <define>__WXMSW__
</define>
243 <if cond=
"FORMAT!='xcode2'">
244 <include>$(WX_DIR)$(WXLIBINCLUDE)
</include>
245 <include>$(WX_DIR)/include
</include>
250 <!-- this ugly tag contains all sys-lib tags used by "wx" template,
251 in order to make sure they are not reorder when wx-lib is moved
252 after __wx-libs-point: -->
253 <define-tag name=
"__wx-syslibs" rules=
"exe,dll,module">
254 <!-- wx 3rd party libs, always use them: -->
255 <sys-lib cond=
"FORMAT!='msevc4prj'">wxtiff$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
256 <sys-lib>wxjpeg$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
257 <sys-lib>wxpng$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
258 <sys-lib>wxzlib$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
259 <!-- For regex we won't use the WX3RDPARTYLIBPOSTIX postfix:
260 unliked tiff, jpeg, png, zlib, expat, when building
261 in Unicode mode, the "u" suffix is appended to regex -->
262 <sys-lib cond=
"FORMAT!='msevc4prj'">wxregex$(WXLIBPOSTFIX)
</sys-lib>
263 <sys-lib>wxexpat$(WX3RDPARTYLIBPOSTFIX)
</sys-lib>
265 <!-- link-in system libs that wx depends on: -->
266 <!-- If on borland, we don't need to do much -->
267 <if cond=
"FORMAT=='borland'">
268 <sys-lib>ole2w32
</sys-lib>
271 <!-- Non-borland, on the other hand... -->
272 <if cond=
"FORMAT not in ['borland','msevc4prj']">
273 <sys-lib>kernel32
</sys-lib>
274 <sys-lib>user32
</sys-lib>
275 <sys-lib>gdi32
</sys-lib>
276 <sys-lib>comdlg32
</sys-lib>
277 <sys-lib>winspool
</sys-lib>
278 <sys-lib>winmm
</sys-lib>
279 <sys-lib>shell32
</sys-lib>
280 <sys-lib>comctl32
</sys-lib>
281 <sys-lib>ole32
</sys-lib>
282 <sys-lib>oleaut32
</sys-lib>
283 <sys-lib>uuid
</sys-lib>
284 <sys-lib>rpcrt4
</sys-lib>
285 <sys-lib>advapi32
</sys-lib>
286 <sys-lib>wsock32
</sys-lib>
289 <!-- Libs common to both borland and MSVC -->
290 <if cond=
"FORMAT=='msvc' or FORMAT=='msvc6prj' or FORMAT=='borland'">
291 <sys-lib>oleacc
</sys-lib>
295 <!-- template for wx executables/dlls: -->
296 <template id=
"wx" template=
"wx-lib">
297 <if cond=
"FORMAT!='xcode2'">
298 <lib-path>$(WX_DIR)$(WXLIBPATH)
</lib-path>
301 <ldflags>$(WXMACHINE_FLAG)
</ldflags>
303 <!-- wx libs must come before 3rd party and sys libs, this is
304 the place where the hack explained above is carried on: -->
309 <if cond=
"FORMAT_SUPPORTS_ACTIONS=='1' and WX_TEST_FOR_SELECTED_WXBUILD=='1'">
312 VERY IMPORTANT: before starting to build all targets of the generated makefile,
313 we need to check if the selected wxWidgets build exists; we do
314 that simply creating the following target; if it fails the make
315 program will halt printing the following nice error message...
316 (much better than the 'could not find wx/*.h file')
318 <action id=
"test_for_selected_wxbuild">
319 <dependency-of>all
</dependency-of>
321 <!-- the @ is to hide these actions from the user -->
323 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
324 echo ----------------------------------------------------------------------------
325 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
326 echo The selected wxWidgets build is not available!
327 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
328 echo Please use the options prefixed with WX_ to select another wxWidgets build.
329 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
330 echo ----------------------------------------------------------------------------
331 @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \