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