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