Committing patch #1604462, which improves autoconf support, adds a wxbase template, allows components to have names which match wx lib naming, etc.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44359 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Ollivier 2007-02-05 01:15:02 +00:00
parent 74fa325376
commit e602dae828
7 changed files with 807 additions and 219 deletions

View file

@ -5,64 +5,233 @@
Presents for building wxWidgets applications using Autoconf or GNU toosets.
See wx.bkl for platform-independent notes.
Usage:
Options WX_CPPFLAGS, WX_CFLAGS, WX_CXXFLAGS, WX_LIBS are defined.
Format-specific notes:
* autoconf:
Beware that you have to use AM_OPTIONS_WXCONFIG and
AM_PATH_WXCONFIG in your configure.in!
AM_PATH_WXCONFIG in your configure.in to get at least the
WX_CPPFLAGS, WX_CFLAGS, WX_CXXFLAGS, WX_LIBS option values defined.
To detect the WX_* option values typically you also want to use
the AM_WXPRESETS_OPTIONS and AM_WXPRESETS_CHECKS macros
(see wxpresets.m4 for more info).
-->
<makefile>
<!-- ============================================================== -->
<!-- Options -->
<!-- ============================================================== -->
<!-- on Unix the WX_PORT is not a fixed value but rather an option -->
<if cond="not isdefined('WX_PORT')">
<set var="WX_PORT_DEFAULT" overwrite="0">auto</set>
<option name="WX_PORT">
<values>auto,gtk1,gtk2,msw,x11,motif,mgl,mac</values>
<default-value>$(WX_PORT_DEFAULT)</default-value>
<description>
Port of the wx library to build against
</description>
</option>
</if>
<!-- ============================================================== -->
<!-- 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"/>
<option name="WX_VERSION_MAJOR"/>
<option name="WX_VERSION_MINOR"/>
<!-- wxpresets.m4 macros will detect all WX_* options defined above -->
<!-- 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="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="value not in ALLLIB_LIST.split()">
<error>Unknown wxWidgets library given in the wx-lib tag</error>
</if>
</define-tag>
</if>
<!-- ============================================================== -->
<!-- GNU makefiles for Unix -->
<!-- ============================================================== -->
<if cond="FORMAT=='gnu'">
<!-- remove those WX_* vars which were created just to avoid the definition
of the WX_* options in wx.bkl -->
<unset var="WX_SHARED"/>
<unset var="WX_UNICODE"/>
<unset var="WX_DEBUG"/>
<unset var="WX_PORT"/>
<unset var="WX_VERSION"/>
<set var="WX_CONFIG_DEFAULT" overwrite="0">wx-config</set>
<option name="WX_CONFIG">
<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) --cflags`</default-value>
<description>C flags to use with wxWidgets code</description>
<set var="WX_PORT_DEFAULT" overwrite="0">
$(DOLLAR)(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 1)
</set>
<option name="WX_PORT">
<values>gtk1,gtk2,msw,x11,motif,mgl,mac,$(WX_PORT_DEFAULT)</values>
<default-value>
$(WX_PORT_DEFAULT)
</default-value>
<description>
Port of the wx library to build against
</description>
</option>
<option name="WX_CXXFLAGS">
<default-value>`$(DOLLAR)(WX_CONFIG) --cxxflags`</default-value>
<description>C++ flags to use with wxWidgets code</description>
<set var="WX_SHARED_DEFAULT" overwrite="0">
$(DOLLAR)(shell if test -z `$(WX_CONFIG) --selected-config | cut -d '-' -f 5`; then echo 1; else echo 0; fi)
</set>
<option name="WX_SHARED">
<values>0,1,$(WX_SHARED_DEFAULT)</values>
<values-description>Static,DLL,$(WX_SHARED_DEFAULT)</values-description>
<default-value>$(WX_SHARED_DEFAULT)</default-value>
<description>
Use DLL build of wx library to use?
</description>
</option>
<option name="WX_CPPFLAGS">
<default-value>`$(DOLLAR)(WX_CONFIG) --cppflags`</default-value>
<description>C preprocessor flags to use with wxWidgets code</description>
<set var="WX_UNICODE_DEFAULT" overwrite="0">
$(DOLLAR)(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 2 | sed 's/unicode/1/;s/ansi/0/')
</set>
<option name="WX_UNICODE">
<values>0,1,$(WX_UNICODE_DEFAULT)</values>
<values-description>ANSI,Unicode,$(WX_UNICODE_DEFAULT)</values-description>
<default-value>$(WX_UNICODE_DEFAULT)</default-value>
<description>
Compile Unicode build of wxWidgets?
</description>
</option>
<option name="WX_RESCOMP">
<default-value>`$(DOLLAR)(WX_CONFIG) --rescomp`</default-value>
<description>wxWidgets resource compiler and flags</description>
<set var="WX_DEBUG_DEFAULT" overwrite="0">
$(DOLLAR)(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 3 | sed 's/debug/1/;s/release/0/')
</set>
<option name="WX_DEBUG">
<values>0,1,$(WX_DEBUG_DEFAULT)</values>
<values-description>Release,Debug,$(WX_DEBUG_DEFAULT)</values-description>
<default-value>$(WX_DEBUG_DEFAULT)</default-value>
<description>
Use debug build of wxWidgets (define __WXDEBUG__)?
</description>
</option>
<set var="WX_VERSION_DEFAULT" overwrite="0">
$(DOLLAR)(shell $(WX_CONFIG) --selected-config | sed -e 's/.*-\([0-9]*\)\.\([0-9]*\)$$/\1\2/')
</set>
<option name="WX_VERSION">
<default-value>$(WX_VERSION_DEFAULT)</default-value>
<description>
Version of the wx library to build against.
</description>
</option>
<!-- Get MAJOR and MINOR version numbers -->
<set var="WX_VERSION_MAJOR" make_var="1">
$(DOLLAR)(shell echo $(DOLLAR)(WX_VERSION) | cut -c1,1)
</set>
<set var="WX_VERSION_MINOR" make_var="1">
$(DOLLAR)(shell echo $(DOLLAR)(WX_VERSION) | cut -c2,2)
</set>
<!--
Using the GNU format creates a configurable makefile just like
a win32 makefile: i.e. a makefile where you can select the wanted
wxWidgets build using the WX_* options.
The difference with win32 makefiles is that WX_DEBUG, WX_UNICODE and
WX_SHARED options have a smart default value which is created using
the installed wx-config or the wx-config given using WX_CONFIG option
-->
<set var="WX_CONFIG_DEBUG_FLAG">
<if cond="WX_DEBUG=='0'">--debug=no</if>
<if cond="WX_DEBUG=='1'">--debug=yes</if>
</set>
<set var="WX_CONFIG_UNICODE_FLAG">
<if cond="WX_UNICODE=='0'">--unicode=no</if>
<if cond="WX_UNICODE=='1'">--unicode=yes</if>
</set>
<set var="WX_CONFIG_SHARED_FLAG">
<if cond="WX_SHARED=='0'">--static=yes</if>
<if cond="WX_SHARED=='1'">--static=no</if>
</set>
<set var="WX_CONFIG_PORT_FLAG">
--toolkit=$(WX_PORT)
</set>
<set var="WX_CONFIG_VERSION_FLAG">
--version=$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
</set>
<set var="WX_CONFIG_FLAGS" make_var="1">
$(WX_CONFIG_DEBUG_FLAG) $(WX_CONFIG_UNICODE_FLAG) $(WX_CONFIG_SHARED_FLAG)
$(WX_CONFIG_PORT_FLAG) $(WX_CONFIG_VERSION_FLAG)
</set>
<set var="WX_CFLAGS">`$(DOLLAR)(WX_CONFIG) --cflags $(WX_CONFIG_FLAGS)`</set>
<set var="WX_CXXFLAGS">`$(DOLLAR)(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)`</set>
<set var="WX_CPPFLAGS">`$(DOLLAR)(WX_CONFIG) --cppflags $(WX_CONFIG_FLAGS)`</set>
<set var="WX_RESCOMP">`$(DOLLAR)(WX_CONFIG) --rescomp $(WX_CONFIG_FLAGS)`</set>
<!--
VERY IMPORTANT: before starting to build all targets of the generated makefile,
we need to check if the selected wxWidgets build exists; we do
that simply creating the following target; if it fails the make
program will halt with the wx-config error message...
-->
<action id="test_for_selected_wxbuild">
<dependency-of>all</dependency-of>
<!-- Use @ to hide to the user that we're running wx-config... -->
<command>@$(DOLLAR)(WX_CONFIG) $(WX_CONFIG_FLAGS)</command>
</action>
<!-- 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>
<set var="FORMAT_OUTPUT_VARIABLES" append="1">WX_CONFIG WX_VERSION</set>
<!-- 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="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) $(WX_CONFIG_FLAGS) --libs $(','.join(__liblist.split()))`</ldlibs>
</if>
<if cond="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>
</if>
<!-- ============================================================== -->
@ -110,27 +279,4 @@ Format-specific notes:
-->
</template>
<!-- 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>