]>
Commit | Line | Data |
---|---|---|
1 | <?xml version="1.0" ?> | |
2 | ||
3 | <!-- Original source: http://wiki.wxwidgets.org/wiki.pl?Bakefile --> | |
4 | <!-- Modified by: Francesco Montorsi <frm@users.sourceforge.net> --> | |
5 | <!-- Vaclav Slavik <vslavik@fastmail.fm> to better fit | |
6 | into Bakefile's presets --> | |
7 | <!-- Creation date: 6/9/2004 --> | |
8 | <!-- Last revision: 22/1/2005 off-CVS --> | |
9 | ||
10 | ||
11 | <makefile> | |
12 | ||
13 | ||
14 | <!-- --> | |
15 | <!-- OPTIONS --> | |
16 | <!-- --> | |
17 | ||
18 | <set var="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL"> | |
19 | <!-- 'NORMAL' here refers to the fact that the formats for which | |
20 | FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL==1 only need | |
21 | additional compiler and/or linker flags (see e.g. WXMACHINE_FLAG) | |
22 | --> | |
23 | <if cond="FORMAT in ['msvc']">1</if> | |
24 | <if cond="FORMAT not in ['msvc']">0</if> | |
25 | </set> | |
26 | <set var="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS"> | |
27 | <!-- the formats for which FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS==1 | |
28 | need special handling: see the docs of the MSVS_PLATFORMS variable in Bakefile docs. | |
29 | --> | |
30 | <if cond="FORMAT in ['msvs2005prj','msvs2008prj']">1</if> | |
31 | <if cond="FORMAT not in ['msvs2005prj','msvs2008prj']">0</if> | |
32 | </set> | |
33 | <set var="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES"> | |
34 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1'">1</if> | |
35 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='1'">1</if> | |
36 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='0' and FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='0'">0</if> | |
37 | </set> | |
38 | ||
39 | <!-- This is a standard option that determines --> | |
40 | <!-- the architecture for which the lib/exe/dll later --> | |
41 | <!-- declared are meant. --> | |
42 | <if cond="not isdefined('TARGET_CPU') and FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1'"> | |
43 | <set var="TARGET_CPU_DEFAULT" overwrite="0">X86</set> | |
44 | <option name="TARGET_CPU"> | |
45 | <values>X86,AMD64,IA64</values> | |
46 | <values-description>i386-compatible,AMD 64 bit,Itanium 64 bit</values-description> | |
47 | <default-value>$(TARGET_CPU_DEFAULT)</default-value> | |
48 | <description> | |
49 | Architecture of the CPU for which to build the executables and libraries | |
50 | </description> | |
51 | </option> | |
52 | </if> | |
53 | <if cond="not isdefined('TARGET_CPU') and FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_VIA_MSVS_PLATFORMS=='1'"> | |
54 | <!-- defining TARGET_CPU also for the formats using the MSVS_PLATFORM variable allows to write | |
55 | easier tests in user bakefiles; e.g.: | |
56 | ||
57 | <set var="MY_ARCH_DEPENDENT_VARIABLE"> | |
58 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='0'">value1</if> | |
59 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='X86'">value2</if> | |
60 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='AMD64'">value3</if> | |
61 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='IA64'">value4</if> | |
62 | </set> | |
63 | --> | |
64 | <set var="TARGET_CPU"> | |
65 | <if cond="MSVS_PLATFORM=='win32'">X86</if> | |
66 | <if cond="MSVS_PLATFORM=='win64'">AMD64</if> | |
67 | <if cond="MSVS_PLATFORM=='ia64'">IA64</if> | |
68 | <!-- MSVS_PLATFORM currently does not support ia64 but this line is still needed by bakefile | |
69 | to correctly set the TARGET_CPU variable --> | |
70 | </set> | |
71 | </if> | |
72 | ||
73 | ||
74 | ||
75 | <!-- HELPER VARIABLES --> | |
76 | <!-- --> | |
77 | ||
78 | ||
79 | <!-- The unicode define we want. By default bakefile --> | |
80 | <!-- makes variables an empty string, so if unicode --> | |
81 | <!-- is not defined $(UNICODE_DEFINE) would expand --> | |
82 | <!-- to nothing (literally). --> | |
83 | <set var="WXUNICODE_DEFINE"> | |
84 | <if cond="WX_UNICODE=='1'">_UNICODE</if> | |
85 | </set> | |
86 | ||
87 | <!-- The debug define we need with win32 compilers --> | |
88 | <!-- (on Linux, the wx-config program is used). --> | |
89 | <set var="WXDEBUG_DEFINE"> | |
90 | <if cond="WX_DEBUG=='1'">__WXDEBUG__</if> | |
91 | </set> | |
92 | ||
93 | <!-- These are handy ways of dealing with the --> | |
94 | <!-- extensions in the library names of the --> | |
95 | <!-- wxWindows library. --> | |
96 | <set var="WX3RDPARTYLIBPOSTFIX"> | |
97 | <if cond="WX_DEBUG=='1'">d</if> | |
98 | </set> | |
99 | ||
100 | <set var="WXCPU"> | |
101 | <if cond="FORMAT=='msevc4prj'">_$(CPU)</if> | |
102 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='AMD64'">_x64</if> | |
103 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES=='1' and TARGET_CPU=='IA64'">_ia64</if> | |
104 | </set> | |
105 | ||
106 | <set var="WXMACHINE_FLAG"> | |
107 | <!-- add the /MACHINE linker flag to formats with "normal" multiple-arch support when building in 64bit mode | |
108 | (formats using the MSVS_PLATFORM variable don't need the /MACHINE linker flag!): --> | |
109 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1' and TARGET_CPU=='AMD64'">/MACHINE:AMD64</if> | |
110 | <if cond="FORMAT_SUPPORTS_MULTIPLE_ARCHITECTURES_NORMAL=='1' and TARGET_CPU=='IA64'">/MACHINE:IA64</if> | |
111 | </set> | |
112 | ||
113 | <set var="WXLIBPATH"> | |
114 | <if cond="WX_SHARED=='0'">$(DIRSEP)lib$(DIRSEP)$(COMPILER_PREFIX)$(WXCPU)_lib</if> | |
115 | <if cond="WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER_PREFIX)$(WXCPU)_dll</if> | |
116 | </set> | |
117 | ||
118 | <!-- under Unix this is an option (detected at configure-time); | |
119 | under Windows this is not an user option! --> | |
120 | <set var="WX_PORT"> | |
121 | <if cond="FORMAT=='msevc4prj'">wince</if> | |
122 | <if cond="FORMAT!='msevc4prj'">msw</if> | |
123 | </set> | |
124 | ||
125 | <set var="WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WX_PORT)$(WXLIBPOSTFIX)</set> | |
126 | ||
127 | ||
128 | <!-- All the possible mixes for the wx library names --> | |
129 | <set var="WXLIB_BASE_NAME"> | |
130 | <if cond="WX_MONOLITHIC=='0'">wxbase$(WX_VERSION)$(WXLIBPOSTFIX)</if> | |
131 | ||
132 | <!-- | |
133 | the trick used to support monolithic builds is here: when the | |
134 | <wx-lib>base</wx-lib> tag is found, and user selected | |
135 | WX_MONOLITHIC=1, then the base library is translated to the | |
136 | monolithic library | |
137 | --> | |
138 | <if cond="WX_MONOLITHIC=='1'">wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)</if> | |
139 | </set> | |
140 | ||
141 | ||
142 | <!-- Libraries whose name is prefixed with 'wxbase' --> | |
143 | <define-global-tag name="define-wxbase-lib-name"> | |
144 | <set var="WXLIB_$(value.upper())_NAME"> | |
145 | <if cond="WX_MONOLITHIC=='0'"> | |
146 | wxbase$(WX_VERSION)$(WXLIBPOSTFIX)_$(value) | |
147 | </if> | |
148 | </set> | |
149 | </define-global-tag> | |
150 | ||
151 | <define-wxbase-lib-name>net</define-wxbase-lib-name> | |
152 | <define-wxbase-lib-name>xml</define-wxbase-lib-name> | |
153 | ||
154 | ||
155 | <!-- Libraries whose name is prefixed with 'wx' only --> | |
156 | <define-global-tag name="define-wxlib-name"> | |
157 | <set var="WXLIB_$(value.upper())_NAME"> | |
158 | <if cond="WX_MONOLITHIC=='0'"> | |
159 | wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value) | |
160 | </if> | |
161 | </set> | |
162 | </define-global-tag> | |
163 | ||
164 | <define-wxlib-name>core</define-wxlib-name> | |
165 | <define-wxlib-name>media</define-wxlib-name> | |
166 | <define-wxlib-name>xrc</define-wxlib-name> | |
167 | <define-wxlib-name>html</define-wxlib-name> | |
168 | <define-wxlib-name>adv</define-wxlib-name> | |
169 | <define-wxlib-name>qa</define-wxlib-name> | |
170 | <define-wxlib-name>aui</define-wxlib-name> | |
171 | <define-wxlib-name>ribbon</define-wxlib-name> | |
172 | <define-wxlib-name>propgrid</define-wxlib-name> | |
173 | <define-wxlib-name>stc</define-wxlib-name> | |
174 | <define-wxlib-name>richtext</define-wxlib-name> | |
175 | <define-wxlib-name>webview</define-wxlib-name> | |
176 | ||
177 | <!-- NOTE: The GL lib is not part of the monolithic build; treat it as a contrib! --> | |
178 | ||
179 | ||
180 | ||
181 | <!-- WX TEMPLATE --> | |
182 | <!-- --> | |
183 | <!-- --> | |
184 | <!-- While not required, templates make your --> | |
185 | <!-- bakefiles much more readable. Templates, in --> | |
186 | <!-- essence, are abstract classes like c++. --> | |
187 | <!-- --> | |
188 | <!-- Your build targets "inherit" the template, --> | |
189 | <!-- along with the info associated with the template --> | |
190 | ||
191 | <!-- --> | |
192 | <!-- wxWidgets LIBRARY/APP TEMPLATE --> | |
193 | <!-- --> | |
194 | <!-- The "base class" of all our build targets --> | |
195 | <!-- This links with the appropriate native --> | |
196 | <!-- libraries required by the platform, the libraries --> | |
197 | <!-- we want for our stuff, and the wxWindows libs. --> | |
198 | ||
199 | <!-- this tag is used to include wx libraries: --> | |
200 | <define-tag name="wx-lib" rules="exe,dll,module"> | |
201 | <if cond="value=='base'"><sys-lib>$(WXLIB_BASE_NAME)</sys-lib></if> | |
202 | <if cond="value=='core'"><sys-lib>$(WXLIB_CORE_NAME)</sys-lib></if> | |
203 | ||
204 | <if cond="value=='net'"><sys-lib>$(WXLIB_NET_NAME)</sys-lib></if> | |
205 | <if cond="value=='xml'"><sys-lib>$(WXLIB_XML_NAME)</sys-lib></if> | |
206 | ||
207 | <if cond="value=='media'"><sys-lib>$(WXLIB_MEDIA_NAME)</sys-lib></if> | |
208 | <if cond="value=='xrc'"><sys-lib>$(WXLIB_XRC_NAME)</sys-lib></if> | |
209 | <if cond="value=='html'"><sys-lib>$(WXLIB_HTML_NAME)</sys-lib></if> | |
210 | <if cond="value=='adv'"><sys-lib>$(WXLIB_ADV_NAME)</sys-lib></if> | |
211 | <if cond="value=='qa'"><sys-lib>$(WXLIB_QA_NAME)</sys-lib></if> | |
212 | <if cond="value=='aui'"><sys-lib>$(WXLIB_AUI_NAME)</sys-lib></if> | |
213 | <if cond="value=='ribbon'"><sys-lib>$(WXLIB_RIBBON_NAME)</sys-lib></if> | |
214 | <if cond="value=='propgrid'"><sys-lib>$(WXLIB_PROPGRID_NAME)</sys-lib></if> | |
215 | <if cond="value=='richtext'"><sys-lib>$(WXLIB_RICHTEXT_NAME)</sys-lib></if> | |
216 | <if cond="value=='webview'"><sys-lib>$(WXLIB_WEBVIEW_NAME)</sys-lib></if> | |
217 | ||
218 | <!-- The GL lib isn't part of the monolithic build, treat it as a contrib: --> | |
219 | <if cond="value=='gl'"> | |
220 | <sys-lib>wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)</sys-lib> | |
221 | </if> | |
222 | ||
223 | <if cond="value=='stc'"> | |
224 | <!-- wxSTC requires also the basic scintilla library | |
225 | which is built as a separate 3rd party library --> | |
226 | <sys-lib>$(WXLIB_STC_NAME)</sys-lib> | |
227 | <sys-lib>wxscintilla$(WX3RDPARTYLIBPOSTFIX)</sys-lib> | |
228 | </if> | |
229 | ||
230 | <if cond="value not in WX_LIB_LIST.split()"> | |
231 | <error>Unknown wxWidgets library given in the wx-lib tag</error> | |
232 | </if> | |
233 | </define-tag> | |
234 | ||
235 | <!-- just a placeholder to mark the place where <wx-lib> will be placed, | |
236 | thanks to the order precedence declaration below it: --> | |
237 | <define-tag name="__wx-libs-point" rules="exe,dll,module"/> | |
238 | <tag-info name="wx-lib" | |
239 | position="before:__wx-libs-point"/> | |
240 | <tag-info name="__wx-syslibs" | |
241 | position="after:__wx-libs-point"/> | |
242 | ||
243 | ||
244 | <!-- template for static wx libraries: --> | |
245 | <template id="wx-lib"> | |
246 | <!-- MISCELLANEOUS --> | |
247 | <if cond="FORMAT=='mingw'"> | |
248 | <define>HAVE_W32API_H</define> | |
249 | <ldflags>-mthreads</ldflags> | |
250 | </if> | |
251 | ||
252 | <define>$(substituteFromDict(WX_SHARED,{'1':'WXUSINGDLL','0':''}))</define> | |
253 | ||
254 | <define>$(WXUNICODE_DEFINE)</define> | |
255 | <define>$(WXDEBUG_DEFINE)</define> | |
256 | <define>__WXMSW__</define> | |
257 | ||
258 | <if cond="FORMAT!='xcode2'"> | |
259 | <include>$(WX_DIR)$(WXLIBINCLUDE)</include> | |
260 | <include>$(WX_DIR)/include</include> | |
261 | </if> | |
262 | </template> | |
263 | ||
264 | ||
265 | <!-- this ugly tag contains all sys-lib tags used by "wx" template, | |
266 | in order to make sure they are not reorder when wx-lib is moved | |
267 | after __wx-libs-point: --> | |
268 | <define-tag name="__wx-syslibs" rules="exe,dll,module"> | |
269 | <!-- wx 3rd party libs, always use them: --> | |
270 | <sys-lib cond="FORMAT!='msevc4prj'">wxtiff$(WX3RDPARTYLIBPOSTFIX)</sys-lib> | |
271 | <sys-lib>wxjpeg$(WX3RDPARTYLIBPOSTFIX)</sys-lib> | |
272 | <sys-lib>wxpng$(WX3RDPARTYLIBPOSTFIX)</sys-lib> | |
273 | <sys-lib>wxzlib$(WX3RDPARTYLIBPOSTFIX)</sys-lib> | |
274 | <!-- For regex we won't use the WX3RDPARTYLIBPOSTIX postfix: | |
275 | unliked tiff, jpeg, png, zlib, expat, when building | |
276 | in Unicode mode, the "u" suffix is appended to regex --> | |
277 | <sys-lib cond="FORMAT!='msevc4prj'">wxregex$(WXLIBPOSTFIX)</sys-lib> | |
278 | <sys-lib>wxexpat$(WX3RDPARTYLIBPOSTFIX)</sys-lib> | |
279 | ||
280 | <!-- link-in system libs that wx depends on: --> | |
281 | <!-- If on borland, we don't need to do much --> | |
282 | <if cond="FORMAT=='borland'"> | |
283 | <sys-lib>ole2w32</sys-lib> | |
284 | </if> | |
285 | ||
286 | <!-- Non-borland, on the other hand... --> | |
287 | <if cond="FORMAT not in ['borland','msevc4prj']"> | |
288 | <sys-lib>kernel32</sys-lib> | |
289 | <sys-lib>user32</sys-lib> | |
290 | <sys-lib>gdi32</sys-lib> | |
291 | <sys-lib>comdlg32</sys-lib> | |
292 | <sys-lib>winspool</sys-lib> | |
293 | <sys-lib>winmm</sys-lib> | |
294 | <sys-lib>shell32</sys-lib> | |
295 | <sys-lib>comctl32</sys-lib> | |
296 | <sys-lib>ole32</sys-lib> | |
297 | <sys-lib>oleaut32</sys-lib> | |
298 | <sys-lib>uuid</sys-lib> | |
299 | <sys-lib>rpcrt4</sys-lib> | |
300 | <sys-lib>advapi32</sys-lib> | |
301 | <sys-lib>wsock32</sys-lib> | |
302 | </if> | |
303 | ||
304 | <!-- Libs common to both borland and MSVC --> | |
305 | <if cond="FORMAT=='msvc' or FORMAT=='msvc6prj' or FORMAT=='borland'"> | |
306 | <sys-lib>oleacc</sys-lib> | |
307 | </if> | |
308 | </define-tag> | |
309 | ||
310 | <!-- template for wx executables/dlls: --> | |
311 | <template id="wx" template="wx-lib"> | |
312 | <if cond="FORMAT!='xcode2'"> | |
313 | <lib-path>$(WX_DIR)$(WXLIBPATH)</lib-path> | |
314 | </if> | |
315 | ||
316 | <ldflags>$(WXMACHINE_FLAG)</ldflags> | |
317 | ||
318 | <!-- wx libs must come before 3rd party and sys libs, this is | |
319 | the place where the hack explained above is carried on: --> | |
320 | <__wx-libs-point/> | |
321 | <__wx-syslibs/> | |
322 | </template> | |
323 | ||
324 | <if cond="FORMAT_SUPPORTS_ACTIONS=='1' and WX_TEST_FOR_SELECTED_WXBUILD=='1'"> | |
325 | ||
326 | <!-- | |
327 | VERY IMPORTANT: before starting to build all targets of the generated makefile, | |
328 | we need to check if the selected wxWidgets build exists; we do | |
329 | that simply creating the following target; if it fails the make | |
330 | program will halt printing the following nice error message... | |
331 | (much better than the 'could not find wx/*.h file') | |
332 | --> | |
333 | <action id="test_for_selected_wxbuild"> | |
334 | <dependency-of>all</dependency-of> | |
335 | ||
336 | <!-- the @ is to hide these actions from the user --> | |
337 | <command> | |
338 | @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \ | |
339 | echo ---------------------------------------------------------------------------- | |
340 | @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \ | |
341 | echo The selected wxWidgets build is not available! | |
342 | @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \ | |
343 | echo Please use the options prefixed with WX_ to select another wxWidgets build. | |
344 | @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \ | |
345 | echo ---------------------------------------------------------------------------- | |
346 | @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \ | |
347 | exit 1 | |
348 | </command> | |
349 | </action> | |
350 | </if> | |
351 | ||
352 | </makefile> |