]> git.saurik.com Git - wxWidgets.git/blame - build/bakefiles/wxpresets/presets/wx_unix.bkl
enabling clip
[wxWidgets.git] / build / bakefiles / wxpresets / presets / wx_unix.bkl
CommitLineData
83c7f6a7
VS
1<?xml version="1.0" ?>
2<!-- $Id$ -->
3
4<!--
5Presents for building wxWidgets applications using Autoconf or GNU toosets.
6See wx.bkl for platform-independent notes.
7
83c7f6a7
VS
8Format-specific notes:
9
10* autoconf:
11 Beware that you have to use AM_OPTIONS_WXCONFIG and
e602dae8
KO
12 AM_PATH_WXCONFIG in your configure.in to get at least the
13 WX_CPPFLAGS, WX_CFLAGS, WX_CXXFLAGS, WX_LIBS option values defined.
14 To detect the WX_* option values typically you also want to use
15 the AM_WXPRESETS_OPTIONS and AM_WXPRESETS_CHECKS macros
16 (see wxpresets.m4 for more info).
83c7f6a7
VS
17
18-->
19
20
21<makefile>
22
e602dae8
KO
23
24
83c7f6a7
VS
25 <!-- ============================================================== -->
26 <!-- Autoconf -->
27 <!-- ============================================================== -->
9864ef3b 28
83c7f6a7 29 <if cond="FORMAT=='autoconf'">
83c7f6a7
VS
30 <option name="WX_CFLAGS"/>
31 <option name="WX_CXXFLAGS"/>
32 <option name="WX_CPPFLAGS"/>
33 <option name="WX_LIBS"/>
692ebda6 34 <option name="WX_RESCOMP"/>
e602dae8
KO
35 <option name="WX_VERSION_MAJOR"/>
36 <option name="WX_VERSION_MINOR"/>
e606c822 37 <option name="WX_PORT"/>
e602dae8 38
e606c822 39 <!-- wxwin.m4 macros will detect all WX_* options defined above -->
e602dae8
KO
40
41
42 <!-- VERY IMPORTANT: <wx-lib>base</wx-lib> must be the last wx-lib tag
43 in all your bakefiles !!
44 -->
45 <define-tag name="wx-lib" rules="exe,dll,module">
46 <if cond="value=='base'">
47 <!-- all wx-dependent libraries should have been already listed
48 thus we can now add WX_LIBS to the linker line -->
49 <ldlibs>$(WX_LIBS)</ldlibs>
e606c822 50 </if>
18cea871 51 <if cond="value not in WX_LIB_LIST.split()">
e602dae8
KO
52 <error>Unknown wxWidgets library given in the wx-lib tag</error>
53 </if>
54 </define-tag>
55 </if>
56
9864ef3b 57
83c7f6a7
VS
58 <!-- ============================================================== -->
59 <!-- GNU makefiles for Unix -->
60 <!-- ============================================================== -->
61
62 <if cond="FORMAT=='gnu'">
e602dae8
KO
63
64 <!-- remove those WX_* vars which were created just to avoid the definition
65 of the WX_* options in wx.bkl -->
66 <unset var="WX_SHARED"/>
67 <unset var="WX_UNICODE"/>
68 <unset var="WX_DEBUG"/>
69 <unset var="WX_PORT"/>
70 <unset var="WX_VERSION"/>
71
369e0d05 72 <set var="WX_CONFIG_DEFAULT" overwrite="0">wx-config</set>
83c7f6a7 73 <option name="WX_CONFIG">
369e0d05 74 <default-value>$(WX_CONFIG_DEFAULT)</default-value>
83c7f6a7
VS
75 <description>Location and arguments of wx-config script</description>
76 </option>
e602dae8
KO
77
78 <set var="WX_PORT_DEFAULT" overwrite="0">
79 $(DOLLAR)(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 1)
80 </set>
81 <option name="WX_PORT">
e606c822
VZ
82 <values>gtk1,gtk2,msw,x11,motif,mgl,mac,dfb</values>
83 <default-value force="1">$(WX_PORT_DEFAULT)</default-value>
e602dae8
KO
84 <description>
85 Port of the wx library to build against
86 </description>
87 </option>
88
89 <set var="WX_SHARED_DEFAULT" overwrite="0">
90 $(DOLLAR)(shell if test -z `$(WX_CONFIG) --selected-config | cut -d '-' -f 5`; then echo 1; else echo 0; fi)
91 </set>
92 <option name="WX_SHARED">
e606c822
VZ
93 <values>0,1</values>
94 <values-description>Static,DLL</values-description>
95 <default-value force="1">$(WX_SHARED_DEFAULT)</default-value>
e602dae8
KO
96 <description>
97 Use DLL build of wx library to use?
98 </description>
83c7f6a7 99 </option>
e602dae8
KO
100
101 <set var="WX_UNICODE_DEFAULT" overwrite="0">
102 $(DOLLAR)(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 2 | sed 's/unicode/1/;s/ansi/0/')
103 </set>
104 <option name="WX_UNICODE">
e606c822
VZ
105 <values>0,1</values>
106 <values-description>ANSI,Unicode</values-description>
107 <default-value force="1">$(WX_UNICODE_DEFAULT)</default-value>
e602dae8
KO
108 <description>
109 Compile Unicode build of wxWidgets?
110 </description>
83c7f6a7 111 </option>
e602dae8
KO
112
113 <set var="WX_DEBUG_DEFAULT" overwrite="0">
114 $(DOLLAR)(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 3 | sed 's/debug/1/;s/release/0/')
115 </set>
116 <option name="WX_DEBUG">
e606c822
VZ
117 <values>0,1</values>
118 <values-description>Release,Debug</values-description>
119 <default-value force="1">$(WX_DEBUG_DEFAULT)</default-value>
e602dae8
KO
120 <description>
121 Use debug build of wxWidgets (define __WXDEBUG__)?
122 </description>
83c7f6a7 123 </option>
e602dae8
KO
124
125 <set var="WX_VERSION_DEFAULT" overwrite="0">
126 $(DOLLAR)(shell $(WX_CONFIG) --selected-config | sed -e 's/.*-\([0-9]*\)\.\([0-9]*\)$$/\1\2/')
127 </set>
128 <option name="WX_VERSION">
129 <default-value>$(WX_VERSION_DEFAULT)</default-value>
130 <description>
131 Version of the wx library to build against.
132 </description>
692ebda6 133 </option>
83c7f6a7 134
e602dae8
KO
135 <!-- Get MAJOR and MINOR version numbers -->
136 <set var="WX_VERSION_MAJOR" make_var="1">
137 $(DOLLAR)(shell echo $(DOLLAR)(WX_VERSION) | cut -c1,1)
138 </set>
139 <set var="WX_VERSION_MINOR" make_var="1">
140 $(DOLLAR)(shell echo $(DOLLAR)(WX_VERSION) | cut -c2,2)
141 </set>
142
143
144 <!--
145 Using the GNU format creates a configurable makefile just like
146 a win32 makefile: i.e. a makefile where you can select the wanted
147 wxWidgets build using the WX_* options.
148
149 The difference with win32 makefiles is that WX_DEBUG, WX_UNICODE and
150 WX_SHARED options have a smart default value which is created using
151 the installed wx-config or the wx-config given using WX_CONFIG option
152 -->
153 <set var="WX_CONFIG_DEBUG_FLAG">
154 <if cond="WX_DEBUG=='0'">--debug=no</if>
155 <if cond="WX_DEBUG=='1'">--debug=yes</if>
156 </set>
157 <set var="WX_CONFIG_UNICODE_FLAG">
158 <if cond="WX_UNICODE=='0'">--unicode=no</if>
159 <if cond="WX_UNICODE=='1'">--unicode=yes</if>
160 </set>
161 <set var="WX_CONFIG_SHARED_FLAG">
162 <if cond="WX_SHARED=='0'">--static=yes</if>
163 <if cond="WX_SHARED=='1'">--static=no</if>
164 </set>
165 <set var="WX_CONFIG_PORT_FLAG">
166 --toolkit=$(WX_PORT)
167 </set>
168 <set var="WX_CONFIG_VERSION_FLAG">
169 --version=$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
170 </set>
171
172 <set var="WX_CONFIG_FLAGS" make_var="1">
173 $(WX_CONFIG_DEBUG_FLAG) $(WX_CONFIG_UNICODE_FLAG) $(WX_CONFIG_SHARED_FLAG)
174 $(WX_CONFIG_PORT_FLAG) $(WX_CONFIG_VERSION_FLAG)
175 </set>
176
177 <set var="WX_CFLAGS">`$(DOLLAR)(WX_CONFIG) --cflags $(WX_CONFIG_FLAGS)`</set>
178 <set var="WX_CXXFLAGS">`$(DOLLAR)(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)`</set>
179 <set var="WX_CPPFLAGS">`$(DOLLAR)(WX_CONFIG) --cppflags $(WX_CONFIG_FLAGS)`</set>
180 <set var="WX_RESCOMP">`$(DOLLAR)(WX_CONFIG) --rescomp $(WX_CONFIG_FLAGS)`</set>
181
182 <!--
183 VERY IMPORTANT: before starting to build all targets of the generated makefile,
184 we need to check if the selected wxWidgets build exists; we do
185 that simply creating the following target; if it fails the make
186 program will halt with the wx-config error message...
187 -->
a78a8f7f
VZ
188 <if cond="WX_TEST_FOR_SELECTED_WXBUILD=='1'">
189 <action id="test_for_selected_wxbuild">
190 <dependency-of>all</dependency-of>
191
192 <!-- Use @ to hide to the user that we're running wx-config... -->
193 <command>@$(DOLLAR)(WX_CONFIG) $(WX_CONFIG_FLAGS)</command>
194 </action>
195 </if>
e602dae8 196
83c7f6a7
VS
197 <!-- we need this but the trick used in default-values above
198 prevents bakefile from detecting it: -->
e602dae8
KO
199 <set var="FORMAT_OUTPUT_VARIABLES" append="1">WX_CONFIG WX_VERSION</set>
200
201
202 <!-- VERY IMPORTANT: <wx-lib>base</wx-lib> must be the last wx-lib tag
203 in all your bakefiles !!
204 -->
205 <define-tag name="wx-lib" rules="exe,dll,module">
206 <if cond="value=='base'">
207 <!-- all wx libraries should have been already specified, thus
208 $(__liblist) should contain the full list... -->
209 <set var="__liblist" append="1">base</set>
210 <ldlibs>`$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs $(','.join(__liblist.split()))`</ldlibs>
211 </if>
212 <if cond="value!='base'">
213 <set var="__liblist" append="1">$(value)</set>
214 </if>
18cea871 215 <if cond="value not in WX_LIB_LIST.split()">
e602dae8
KO
216 <error>Unknown wxWidgets library given in the wx-lib tag</error>
217 </if>
218 </define-tag>
83c7f6a7 219 </if>
9864ef3b 220
83c7f6a7
VS
221 <!-- ============================================================== -->
222 <!-- Common code -->
223 <!-- ============================================================== -->
9864ef3b 224
83c7f6a7
VS
225 <if cond="FORMAT not in ['gnu','autoconf']">
226 <error>
227 Don't include presets/wx_unix.bkl directly, use presets/wx.bkl.
228 </error>
229 </if>
9864ef3b 230
692ebda6 231 <!--
67533115
VZ
232 We need to re-define the WINDRES resource compiler name to the resource compiler
233 returned by 'wx-config - -rescomp' since this option returns both the name of the
234 resource compiler to use (windres) and the flags required for that compiler.
692ebda6
JS
235
236 This line typically does something *only* when the Makefile.in generated
237 using this bakefile, is used on Windows with MSYS (when using Cygwin, resources
238 are not compiled at all).
67533115
VZ
239 Without this line, in fact, when compiling with MSYS on Windows, the - -include-dir
240 option which tells windres to look in wxWidgets\include folder would be missing and
241 then windres would fail to find the wxMSW resources.
242
243 NOTE: overwriting the WINDRES variable we add wxWidgets resource flags to
244 all targets which include this bakefile; this could be useless to those
245 targets which are not wx-based eventually present in that bakefile but
246 in any case it shouldn't do any harm.
692ebda6 247 -->
67533115 248 <set var="WINDRES">$(WX_RESCOMP)</set>
692ebda6 249
c07e76fa 250 <template id="wx-lib">
83c7f6a7
VS
251 <cxxflags>$(WX_CXXFLAGS)</cxxflags>
252 <cflags>$(WX_CFLAGS)</cflags>
c07e76fa
VS
253 </template>
254
255 <template id="wx" template="wx-lib">
9864ef3b
VZ
256 <!--
257 Don't include the $(WX_LIBS) variable in linker options here since
258 it would make impossible for the user to obtain the right library
259 order when he needs to specify, *before* WX_LIBS, its own libraries
260 that depend on wxWidgets libraries; to avoid this, we include
261 $(WX_LIBS) as soon as we found the <wx-lib>base</wx-lib> tag which
262 the user should always put *after* all other wx-dependent libraries
263 -->
83c7f6a7
VS
264 </template>
265
83c7f6a7 266</makefile>