add 64bit support to those formats which I could test and which support 64bit build...
[wxWidgets.git] / build / bakefiles / wxpresets / presets / wx_win32.bkl
1 <?xml version="1.0" ?>
2 <!-- $Id$ -->
3
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                               -->
10 <!--                $Id$ -->
11
12
13 <makefile>
14
15
16     <!--                                                            -->
17     <!--                        OPTIONS                             -->
18     <!--                                                            -->
19
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)
24          -->
25         <if cond="FORMAT in ['msvc']">1</if>
26         <if cond="FORMAT not in ['msvc']">0</if>
27     </set>
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.
31          -->
32         <if cond="FORMAT in ['msvs2005prj','msvs2008prj']">1</if>
33         <if cond="FORMAT not in ['msvs2005prj','msvs2008prj']">0</if>
34     </set>
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>
39     </set>
40     
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>
50             <description>
51                 Architecture of the CPU for which to build the executables and libraries
52             </description>
53         </option>
54     </if>
55
56
57
58     <!--                     HELPER VARIABLES                       -->
59     <!--                                                            -->
60
61
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>
68     </set>
69
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>
74     </set>
75
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>
81     </set>
82
83     <set var="WXCPU">
84         <if cond="FORMAT=='msevc4prj'">_$(CPU)</if>
85         
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>
89         
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>
92     </set>
93     
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>
98     </set>
99     
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>
103     </set>
104     
105     <!-- under Unix this is an option (detected at configure-time);
106          under Windows this is not an user option! -->
107     <set var="WX_PORT">
108         <if cond="FORMAT=='msevc4prj'">wince</if>
109         <if cond="FORMAT!='msevc4prj'">msw</if>
110     </set>
111
112     <set var="WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WX_PORT)$(WXLIBPOSTFIX)</set>
113
114
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>
118
119         <!--
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
123             monolithic library
124         -->
125         <if cond="WX_MONOLITHIC=='1'">wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)</if>
126     </set>
127
128
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)
134             </if>
135     </set>
136     </define-global-tag>
137
138     <define-wxbase-lib-name>net</define-wxbase-lib-name>
139     <define-wxbase-lib-name>xml</define-wxbase-lib-name>
140
141
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)
147             </if>
148         </set>
149     </define-global-tag>
150
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>
162
163     <!-- NOTE: The GL lib is not part of the monolithic build; treat it as a contrib! -->
164
165
166
167     <!--                        WX TEMPLATE                         -->
168     <!--                                                            -->
169     <!--                                                            -->
170     <!--    While not required, templates make your                 -->
171     <!--    bakefiles much more readable.  Templates, in            -->
172     <!--    essence, are abstract classes like c++.                 -->
173     <!--                                                            -->
174     <!--    Your build targets "inherit" the template,              -->
175     <!--    along with the info associated with the template        -->
176
177     <!--                                                            -->
178     <!--                wxWidgets LIBRARY/APP TEMPLATE              -->
179     <!--                                                            -->
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.          -->
184
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>
189
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>
192
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>
202
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>
206         </if>
207
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>
213         </if>
214
215         <if cond="value not in WX_LIB_LIST.split()">
216             <error>Unknown wxWidgets library given in the wx-lib tag</error>
217         </if>
218     </define-tag>
219
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"/>
227
228
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>
235         </if>
236
237         <define>$(substituteFromDict(WX_SHARED,{'1':'WXUSINGDLL','0':''}))</define>
238
239         <define>$(WXUNICODE_DEFINE)</define>
240         <define>$(WXDEBUG_DEFINE)</define>
241         <define>__WXMSW__</define>
242
243         <if cond="FORMAT!='xcode2'">
244             <include>$(WX_DIR)$(WXLIBINCLUDE)</include>
245             <include>$(WX_DIR)/include</include>
246         </if>
247     </template>
248
249
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>
264
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>
269         </if>
270
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>
287         </if>
288
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>
292         </if>
293     </define-tag>
294
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>
299         </if>
300
301         <ldflags>$(WXMACHINE_FLAG)</ldflags>
302             
303         <!-- wx libs must come before 3rd party and sys libs, this is
304              the place where the hack explained above is carried on: -->
305         <__wx-libs-point/>
306         <__wx-syslibs/>
307     </template>
308
309     <if cond="FORMAT_SUPPORTS_ACTIONS=='1' and WX_TEST_FOR_SELECTED_WXBUILD=='1'">
310
311         <!--
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')
317         -->
318         <action id="test_for_selected_wxbuild">
319             <dependency-of>all</dependency-of>
320
321             <!-- the @ is to hide these actions from the user -->
322             <command>
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 \
332                     exit 1
333             </command>
334         </action>
335     </if>
336
337 </makefile>