Usage:
Options WX_CPPFLAGS, WX_CFLAGS, WX_CXXFLAGS, WX_LIBS are defined.
-
+
Format-specific notes:
<!-- ============================================================== -->
<!-- Autoconf -->
<!-- ============================================================== -->
-
+
<if cond="FORMAT=='autoconf'">
<!-- Autoconf backend is simplicity itself thanks to wx-config... -->
<option name="WX_CFLAGS"/>
<option name="WX_CXXFLAGS"/>
<option name="WX_CPPFLAGS"/>
<option name="WX_LIBS"/>
+ <option name="WX_RESCOMP"/>
</if>
-
+
<!-- ============================================================== -->
<!-- GNU makefiles for Unix -->
<!-- ============================================================== -->
<if cond="FORMAT=='gnu'">
+ <set var="WX_CONFIG_DEFAULT" overwrite="0">wx-config</set>
<option name="WX_CONFIG">
- <default-value>wx-config</default-value>
+ <default-value>$(WX_CONFIG_DEFAULT)</default-value>
<description>Location and arguments of wx-config script</description>
</option>
<option name="WX_CFLAGS">
<default-value>`$(DOLLAR)(WX_CONFIG) --cppflags`</default-value>
<description>C preprocessor flags to use with wxWidgets code</description>
</option>
- <option name="WX_LIBS">
- <default-value>`$(DOLLAR)(WX_CONFIG) --libs`</default-value>
- <description>wxWidgets libraries to link against</description>
+ <option name="WX_RESCOMP">
+ <default-value>`$(DOLLAR)(WX_CONFIG) --rescomp`</default-value>
+ <description>wxWidgets resource compiler and flags</description>
</option>
<!-- we need this but the trick used in default-values above
prevents bakefile from detecting it: -->
<set var="FORMAT_OUTPUT_VARIABLES" append="1">WX_CONFIG</set>
</if>
-
+
<!-- ============================================================== -->
<!-- Common code -->
<!-- ============================================================== -->
-
+
<if cond="FORMAT not in ['gnu','autoconf']">
<error>
Don't include presets/wx_unix.bkl directly, use presets/wx.bkl.
</error>
</if>
-
+
+ <!--
+ We need to re-define the resource compiler, used by bakefile when compiling
+ resources, to the resource compiler returned by 'wx-config --rescomp' since
+ 'wx-config --rescomp' returns both the name of the resource compiler to use
+ and the flags required for that compiler (rcflags are rccompiler-specific
+ and thus it would be wrong to use them with other resource compilers).
+
+ This line typically does something *only* when the Makefile.in generated
+ using this bakefile, is used on Windows with MSYS (when using Cygwin, resources
+ are not compiled at all).
+
+ NOTE: overwriting the RESCOMP variable we modify the entire Bakefile behaviour
+ for resource compilation; this could be a problem if the bakefile which
+ includes this file needs the standard Bakefile resource compiler to
+ build a non wx-based application.
+ -->
+ <set var="RESCOMP">$(WX_RESCOMP)</set>
+
<template id="wx-lib">
<cxxflags>$(WX_CXXFLAGS)</cxxflags>
<cflags>$(WX_CFLAGS)</cflags>
</template>
<template id="wx" template="wx-lib">
- <ldlibs>$(WX_LIBS)</ldlibs>
+ <!--
+ Don't include the $(WX_LIBS) variable in linker options here since
+ it would make impossible for the user to obtain the right library
+ order when he needs to specify, *before* WX_LIBS, its own libraries
+ that depend on wxWidgets libraries; to avoid this, we include
+ $(WX_LIBS) as soon as we found the <wx-lib>base</wx-lib> tag which
+ the user should always put *after* all other wx-dependent libraries
+ -->
</template>
- <!-- not used together with wx-config: -->
- <define-tag name="wx-lib" rules="exe,dll,module"/>
+ <!-- VERY IMPORTANT: <wx-lib>base</wx-lib> must be the last wx-lib tag
+ in all your bakefiles !!
+ -->
+ <define-tag name="wx-lib" rules="exe,dll,module">
+ <if cond="FORMAT=='autoconf' and value=='base'">
+ <!-- all wx-dependent libraries should have been already listed
+ thus we can now add WX_LIBS to the linker line -->
+ <ldlibs>$(WX_LIBS)</ldlibs>
+ </if>
+ <if cond="FORMAT=='gnu' and value=='base'">
+ <!-- all wx libraries should have been already specified, thus
+ $(__liblist) should contain the full list... -->
+ <set var="__liblist" append="1">base</set>
+ <ldlibs>`$(WX_CONFIG) --libs $(','.join(__liblist.split()))`</ldlibs>
+ </if>
+ <if cond="FORMAT=='gnu' and value!='base'">
+ <set var="__liblist" append="1">$(value)</set>
+ </if>
+ <if cond="value not in ALLLIB_LIST.split()">
+ <error>Unknown wxWidgets library given in the wx-lib tag</error>
+ </if>
+ </define-tag>
</makefile>