]> git.saurik.com Git - wxWidgets.git/commitdiff
Committing patch #1604462, which improves autoconf support, adds a wxbase template...
authorKevin Ollivier <kevino@theolliviers.com>
Mon, 5 Feb 2007 01:15:02 +0000 (01:15 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Mon, 5 Feb 2007 01:15:02 +0000 (01:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44359 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

build/bakefiles/wxpresets/libsample/configure.in [new file with mode: 0644]
build/bakefiles/wxpresets/libsample/libsample.bkl [new file with mode: 0644]
build/bakefiles/wxpresets/libsample/libsample.cpp [new file with mode: 0644]
build/bakefiles/wxpresets/presets/wx.bkl
build/bakefiles/wxpresets/presets/wx_unix.bkl
build/bakefiles/wxpresets/presets/wx_win32.bkl
build/bakefiles/wxpresets/sample/minimal.bkl

diff --git a/build/bakefiles/wxpresets/libsample/configure.in b/build/bakefiles/wxpresets/libsample/configure.in
new file mode 100644 (file)
index 0000000..f31309a
--- /dev/null
@@ -0,0 +1,64 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([libsample],[1.2.5],[vslavik@fastmail.fm])
+AC_CONFIG_SRCDIR([libsample.cpp])
+
+
+dnl ---------------------------------------------------------------------------
+dnl DEFINE CONFIGURE OPTIONS
+dnl ---------------------------------------------------------------------------
+
+dnl define all the wx-config related options
+dnl (i.e. --with-wxdir, --with-wx-config, --with-wx-prefix, --with-wx-exec-prefix)
+WX_CONFIG_OPTIONS
+
+dnl define all the wxpresets related options
+WX_STANDARD_OPTIONS([debug,unicode,shared,toolkit,wxshared])
+
+
+
+dnl ---------------------------------------------------------------------------
+dnl CONFIGURE CHECKS
+dnl ---------------------------------------------------------------------------
+
+dnl these checks are required by bakefile:
+AC_CANONICAL_SYSTEM
+AC_PROG_AWK
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_RANLIB
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_CXXCPP
+
+dnl we want to always have DEBUG==WX_DEBUG and UNICODE==WX_UNICODE
+WX_DEBUG=$DEBUG
+WX_UNICODE=$UNICODE
+
+dnl the following macros will search for the best matching wxWidgets build 
+dnl (taking in count the values of the --enable-debug|unicode|shared and of
+dnl the --with-toolkit|wxshared options) and then set appropriately all the
+dnl WX_* options
+WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
+WX_CONFIG_CHECK([2.8.0], [wxWin=1],,[core,base],[$WXCONFIG_FLAGS])
+WX_DETECT_STANDARD_OPTION_VALUES
+
+dnl here all WX_* option values are available for your own processing...
+
+
+
+
+dnl ---------------------------------------------------------------------------
+dnl CONFIGURE END
+dnl ---------------------------------------------------------------------------
+
+AC_BAKEFILE([m4_include(autoconf_inc.m4)])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+
+
+dnl show a nice summary of the chosen build settings to the user
+WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN
+WX_STANDARD_OPTIONS_SUMMARY_MSG_END
+
diff --git a/build/bakefiles/wxpresets/libsample/libsample.bkl b/build/bakefiles/wxpresets/libsample/libsample.bkl
new file mode 100644 (file)
index 0000000..7bfe891
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" ?>
+<!-- $Id$ -->
+
+<makefile>
+
+    <include file="presets/wx.bkl"/>
+
+
+    <!-- a typical nice feature which wxpresets make available to wx-based programs
+         is to allow the user to build with different configurations the same project;
+         this is achieved in fundamental steps:
+
+          1) set a different BUILDDIR for different build configurations
+          2) set different output dirs for the libraries built with a
+             different shared/static setting
+          3) set different output names for the libraries built with a
+             different unicode/debug setting
+
+         the following line does step #1:
+    -->
+    <set-wxlike-builddir/>
+
+    <!-- through the use of the 'wx-lib' and 'wxlike' template, we'll get
+         the ability to compile against any wxWidgets build using the same
+         configuration of that wxWidgets build.
+    -->
+    <template id="my" template="wx-lib,wxlike">
+
+        <!-- wxlike-libdirname does step #2 (see initial comment) -->
+        <wxlike-libdirname/>
+
+        <sources>libsample.cpp</sources>
+    </template>
+
+
+    <lib id="static" template="my" cond="WX_SHARED=='0'">
+        <!-- wxlike-libname does step #3 (see initial comment) -->
+        <wxlike-libname prefix='sample'>test</wxlike-libname>
+    </lib>
+
+    <dll id="shared" template="my" cond="WX_SHARED=='1'">
+        <!-- wxlike-dllname does step #3 (see initial comment) -->
+        <wxlike-dllname prefix='sample'>test</wxlike-dllname>
+        <define>WXMAKINGDLL_LIBSAMPLE</define>
+
+        <wx-lib>core</wx-lib>
+        <wx-lib>base</wx-lib>
+    </dll>
+
+</makefile>
diff --git a/build/bakefiles/wxpresets/libsample/libsample.cpp b/build/bakefiles/wxpresets/libsample/libsample.cpp
new file mode 100644 (file)
index 0000000..79b7f85
--- /dev/null
@@ -0,0 +1,41 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        libsample.cpp
+// Purpose:     The source of a dummy sample wx-based library
+// Author:      Francesco Montorsi
+// Modified by:
+// Created:     26/11/06
+// RCS-ID:      $Id$
+// Copyright:   (c) Francesco Montorsi
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers)
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+void MyUtilityFunction()
+{
+    wxPrintf(wxT("Hello world!\n"));
+    fflush(stdout);
+}
index 0b75822c9d992eac58ac8358d40ecc2c0ba95761..2eef873e0b4c928e382c953b8f1a7c7b84c4d371 100644 (file)
@@ -4,7 +4,94 @@
 <!--
     Presets for building wxWidgets applications.
 
-    FIXME: docs
+    These presets provide the following "public" interface:
+
+    OPTIONS:
+
+    - WX_* : used to let the user of the generated makefile choose a wxWidgets
+             build among those available; you can use them in your project to
+             e.g. build a target only if WX_DEBUG is 0 or if WX_PORT is "msw".
+
+
+    VARIABLES:
+
+    - WXLIBPOSTFIX: contains the [u][d] string which is typically useful when
+                    defining names of directories/files which should coexist
+                    with other builds using different wxWidgets configurations.
+
+
+    TEMPLATES:
+
+    - wx, wx-lib: templates to be used respectively for <dll>/<exe> and <lib>
+                  targets; they add all the wxWidgets-related settings (e.g. the
+                  include and library search paths, the __WXDEBUG__ symbol, etc)
+
+    - wxconsole: to be used when building console-only libraries or apps
+                 (adds the wxUSE_GUI=0 define).
+
+    - wxlike: this template should be combined with "wx" or "wx-lib" and will
+              make your project build with the same Unicode, debug & shared
+              config as the wxWidgets build selected using the WX_* options.
+
+
+    TARGET TAGS:
+
+    - <wx-lib>: to define which wxWidgets libraries to link with;
+                please note that you should use them in the right order or
+                linking under Unix would result in errors, e.g.
+
+                    <wx-lib>core</wx-lib>
+                    <wx-lib>base</wx-lib>
+
+                is correct, but the reverse is not (if lib A depends on lib B, then
+                lib A must be listed before B). So <wx-lib>base</wx-lib>
+                (which must always be present) should be the last wx-lib tag.
+
+    - <wxlike-libname>,
+      <wxlike-dllname>: useful if you want to have a build logic similar to the
+                        wxWidgets build logic which allows different builds to
+                        coexist without conflicts. These tags helps you to name
+                        libraries using the same wxWidgets rules and thus avoid
+                        conflicts between libraries compiled in e.g. Unicode,
+                        shared mode and those compiled in ANSI, shared mode &c.
+
+    - <wxlike-lib>: if your library/application needs to link with both
+                    wxWidgets and some other wx-based library, which in turn
+                    follows the wxWidgets naming conventions, then this tag is
+                    what you need to reference the wx-based additional library.
+
+    - <wxlike-paths>: if your library/application needs to cpmpile & link with both
+                      wxWidgets and some other wx-based library, which in turn
+                      follows the wxWidgets naming conventions, then this tag is
+                      what you need to add to the compiler and linker flags the paths
+                      of the "include" and "lib" folders of the wx-based additional library.
+
+
+    GLOBAL TAGS:
+
+    - <set-wxlike-builddir>: sets BUILDDIR using wxWidgets naming rules to help
+                             to keep object files compiled with different
+                             settings separate.
+
+
+ NOTE: as a reference here is a list of all wxWidgets libraries satisfying
+       the dependency constraints mentioned in <wx-lib> description:
+
+        <wx-lib>richtext</wx-lib>
+        <wx-lib>aui</wx-lib>
+        <wx-lib>qa</wx-lib>
+        <wx-lib>dbgrid</wx-lib>
+        <wx-lib>gl</wx-lib>
+        <wx-lib>odbc</wx-lib>
+        <wx-lib>xrc</wx-lib>
+        <wx-lib>html</wx-lib>
+        <wx-lib>media</wx-lib>
+        <wx-lib>adv</wx-lib>
+        <wx-lib>net</wx-lib>
+        <wx-lib>xml</wx-lib>
+        <wx-lib>core</wx-lib>
+        <wx-lib>base</wx-lib>
+
 -->
 
 
 
     <!-- this variable identifies the version of the wx presets.
          this is changed only when major changes to wxpresets take place. -->
-    <set var="WX_PRESETS_VERSION">3</set>
+    <set var="WX_PRESETS_VERSION">4</set>
 
-    <!-- list of known libraries used by wx-lib tag defined in wx_unix.bkl and wx_win32.bkl -->
+    <!-- list of known libraries used by wx-lib tag defined in wx_unix.bkl and wx_win32.bkl
+         VERY IMPORTANT: when updating this list also update the <wx-lib> and <wx-all-libs>
+                         tag definitions.
+    -->
     <set var="LIB_LIST">
         base core net xml odbc xrc html adv media gl dbgrid qa aui richtext
     </set>
 
     <!-- NOTE: refer to the NET contrib using NETUTILS instead of NET
-               (which is already in LIB_LIST) -->
-    <set var="CONTRIBLIB_LIST">animate applet deprecated fl foldbar gizmos mmedia netutils ogl plot stc svg</set>
+               (which is already in LIB_LIST)
+    -->
+    <set var="CONTRIBLIB_LIST">
+        applet deprecated fl foldbar gizmos mmedia netutils ogl plot stc svg
+    </set>
     <set var="ALLLIB_LIST">$(LIB_LIST) $(CONTRIBLIB_LIST)</set>
 
     <!-- this is a temporary variable until there is non general    -->
     </set>
 
 
+
+    <!--                        OPTIONS                             -->
+    <!--                                                            -->
+    <!--    These are essentially the configurations you            -->
+    <!--    want in bakefile.                                       -->
+    <!--                                                            -->
+    <!--    In MSVC these are the different build                   -->
+    <!--    configurations you can have (in the build menu),        -->
+    <!--    and in autoconf is enabled with enable-xxx=xx.          -->
+    <!--    For other compilers a separate configuration            -->
+    <!--    file is created (such as config.gcc on gcc)             -->
+    <!--    which has several options a user can modify.            -->
+    <!--                                                            -->
+    <!--    Note that the above only happens if an option           -->
+    <!--    is not constant, i.e. if it cannot be determined        -->
+    <!--    by bakefile itself.                                     -->
+    <!--    Also note that for 'autoconf' format these options      -->
+    <!--    are only useful when used together with wxpresets.m4    -->
+    <!--    macro file which contains macros for detecting the      -->
+    <!--    option values for wx-based projects. See wxpresets.m4   -->
+    <!--    comments for more info.                                 -->
+
+
+    <!-- Presets for limited dmars make.exe format: -->
+    <if cond="FORMAT=='dmars'">
+        <set var="WX_UNICODE">0</set>
+        <set var="WX_DEBUG">1</set>
+        <set var="WX_SHARED">0</set>
+    </if>
+
+    <!-- 'gnu' format needs to redefine the following options later in wx_unix.bkl -->
+    <if cond="FORMAT=='gnu'">
+        <set var="WX_UNICODE"/>
+        <set var="WX_DEBUG"/>
+        <set var="WX_SHARED"/>
+        <set var="WX_PORT"/>
+        <set var="WX_VERSION"/>
+    </if>
+
+
+    <!--    This is a standard option that determines               -->
+    <!--    whether the user wants to build this library as         -->
+    <!--    a dll or as a static library.                           -->
+    <if cond="not isdefined('WX_SHARED')">
+        <set var="WX_SHARED_DEFAULT" overwrite="0">0</set>
+        <option name="WX_SHARED">
+            <values>0,1</values>
+            <values-description>Static,DLL</values-description>
+            <default-value>$(WX_SHARED_DEFAULT)</default-value>
+            <description>
+                Use DLL build of wx library to use?
+            </description>
+        </option>
+    </if>
+
+    <!-- Configuration for building the bakefile with               -->
+    <!-- unicode strings or not (unicode or ansi).                  -->
+    <if cond="not isdefined('WX_UNICODE')">
+        <set var="WX_UNICODE_DEFAULT" overwrite="0">0</set>
+        <option name="WX_UNICODE">
+            <values>0,1</values>
+            <values-description>ANSI,Unicode</values-description>
+            <default-value>$(WX_UNICODE_DEFAULT)</default-value>
+            <description>
+                Compile Unicode build of wxWidgets?
+            </description>
+        </option>
+    </if>
+
+    <if cond="not isdefined('WX_DEBUG')">
+        <set var="WX_DEBUG_DEFAULT" overwrite="0">1</set>
+        <option name="WX_DEBUG">
+            <values>0,1</values>
+            <values-description>Release,Debug</values-description>
+            <default-value>$(WX_DEBUG_DEFAULT)</default-value>
+            <description>
+                Use debug build of wxWidgets (define __WXDEBUG__)?
+            </description>
+        </option>
+    </if>
+
+    <if cond="not isdefined('WX_VERSION')">
+        <set var="WX_VERSION_DEFAULT" overwrite="0">28</set>
+        <option name="WX_VERSION">
+            <default-value>$(WX_VERSION_DEFAULT)</default-value>
+            <description>
+                Version of the wx library to build against.
+            </description>
+        </option>
+    </if>
+
+    <if cond="not isdefined('WX_MONOLITHIC')">
+        <set var="WX_MONOLITHIC_DEFAULT" overwrite="0">0</set>
+        <option name="WX_MONOLITHIC">
+            <values>0,1</values>
+            <values-description>Multilib,Monolithic</values-description>
+            <default-value>$(WX_MONOLITHIC_DEFAULT)</default-value>
+            <description>
+                Use monolithic build of wxWidgets?
+            </description>
+        </option>
+    </if>
+
     <!-- The directory where wxWidgets is installed: -->
     <if cond="not isdefined('WX_DIR')">
         <set var="WX_DIR_DEFAULT" overwrite="0">$(DOLLAR)($(ENV_VAR)WXWIN)</set>
 
 
 
+    <!--                     HELPER VARIABLES                       -->
+    <!--                                                            -->
+
+    <!--    These are handy ways of dealing with the                -->
+    <!--    extensions in the library names of the                  -->
+    <!--    wxWindows library.                                      -->
+    <set var="WXLIBPOSTFIX">
+        <if cond="WX_DEBUG=='1' and WX_UNICODE=='1'">ud</if>
+        <if cond="WX_DEBUG=='1' and WX_UNICODE=='0'">d</if>
+        <if cond="WX_DEBUG=='0' and WX_UNICODE=='1'">u</if>
+    </set>
+
+
+
+
     <!-- this is just a wrapper that includes the real implementation: -->
 
     <set var="__wx_included_impl">0</set>
         <error>This format is not (yet) supported by wx preset.</error>
     </if>
 
+
+
+
+    <!--                     HIGH-LEVEL TEMPLATE                    -->
+    <!--                                                            -->
+
+    <!-- Combine 'wxlike' with 'wx' or 'wx-lib' templates to have your
+         project build in the same configuration used by the selected
+         wxWidgets build -->
+    <template id="wxlike">
+        <!-- WX_DEBUG-dependent -->
+        <set var="_OPT">
+            <if cond="WX_DEBUG=='1'">off</if>
+            <if cond="WX_DEBUG=='0'">speed</if>
+        </set>
+        <set var="_DEBUGINFO">
+            <if cond="WX_DEBUG=='1'">on</if>
+            <if cond="WX_DEBUG=='0'">off</if>
+        </set>
+
+        <if cond="FORMAT!='autoconf'">
+            <optimize>$(_OPT)</optimize>
+            <debug-info>$(_DEBUGINFO)</debug-info>
+        </if>
+    </template>
+
+    <!-- Template for building wx-based console applications -->
+    <template id="wxconsole" template="wx">
+        <define>wxUSE_GUI=0</define>
+        <app-type>console</app-type>
+    </template>
+
+
+
+    <!--                       UTILITY TAGS                         -->
+    <!--                                                            -->
+
+    <!-- private helper tag -->
+    <define-tag name="__setlibname" rules="lib,dll,module">
+        <set var="__temp">
+            <if cond="FORMAT!='autoconf' and FORMAT!='gnu'">
+                $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
+            </if>
+            <if cond="FORMAT=='autoconf' or FORMAT=='gnu'">
+                $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
+            </if>
+        </set>
+    </define-tag>
+
+    <!-- A simple tag which helps you to define a library name using the same rules used
+         by wxWidgets. Use the 'prefix' attribute to add your lib's prefix.
+         E.g.:
+             <wxlike-libname prefix='mylib'>module1</wxlike-libname>
+             <wxlike-libname prefix='mylib'>module2</wxlike-libname>
+    -->
+    <define-tag name="wxlike-libname" rules="lib">
+        <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
+        <libname>$(__temp)</libname>
+    </define-tag>
+
+    <!-- exactly like <wxlike-libname> but this one sets the DLL name (and the DLL lib import name)
+         and thus must be used only inside a <dll> target...
+    -->
+    <define-tag name="wxlike-dllname" rules="dll,module">
+        <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
+        <libname>$(__temp)</libname>
+        <dllname>$(__temp)</dllname>
+    </define-tag>
+
+    <!-- Links against a library which uses the same wxWidgets conventions.
+    -->
+    <define-tag name="wxlike-lib" rules="exe,lib,dll,module">
+        <__setlibname prefix="$(attributes['prefix'])">$(value)</__setlibname>
+        <sys-lib>$(__temp)</sys-lib>
+    </define-tag>
+
+    <!-- Sets as output folder for the generated lib/dll a directory
+         called "lib/$(COMPILER)_lib|dll", just like wxWidgets does.
+         This makes it possible to keep separed the libraries compiled with
+         different compilers and with a different value for WX_SHARED.
+    -->
+    <define-tag name="wxlike-libdirname" rules="lib,dll">
+        <if cond="FORMAT!='autoconf'">
+            <set var="_DIRNAME_SHARED_SUFFIX">
+                <if cond="WX_SHARED=='0'">lib</if>
+                <if cond="WX_SHARED=='1'">dll</if>
+            </set>
+            <set var="_DIRNAME">
+                lib/$(COMPILER)_$(_DIRNAME_SHARED_SUFFIX)
+            </set>
+
+            <dirname>$(_DIRNAME)</dirname>
+
+            <add-target target="make_lib_dir_$(id)" type="action"/>
+            <modify-target target="make_lib_dir_$(id)">
+                <command cond="TOOLSET=='unix'">
+                    @mkdir -p $(_DIRNAME)
+                </command>
+                <command cond="TOOLSET in ['win32','os2','dos']">
+                    if not exist $(_DIRNAME) mkdir $(_DIRNAME)
+                </command>
+                <dependency-of>$(id)</dependency-of>
+            </modify-target>
+
+        </if>
+        <if cond="FORMAT=='autoconf'">
+            <dirname>lib</dirname>
+        </if>
+    </define-tag>
+
+    <!-- Adds to the compiler & linker flags the path for the "include" and the
+         "lib" folders of a library following wxWidgets conventions which is 
+         located in $(value).
+    -->
+    <define-tag name="wxlike-paths" rules="exe,lib,dll,module">
+        <if cond="FORMAT!='autoconf'">
+            <!-- WXLIBPATH is a path like "/lib/vc_lib"
+                 NOTE: even if this template is going to be used for a "lib"
+                       target (which does not uses lib-paths at all), we can still
+                       use the <lib-path> target: it will just be discarded
+             -->
+            <lib-path>$(value)$(WXLIBPATH)</lib-path>
+
+            <!-- no special include paths for a lib following wxWidgets naming
+                 conventions -->
+            <include>$(value)/include</include>
+        </if>
+
+        <!-- for autoconf format the user should use CPPFLAGS and LDFLAGS to
+             specify non-system paths since the wx-based library should have
+             been installed in standard paths
+        -->
+    </define-tag>
+
+    <!-- Sets the BUILDDIR variable using the same rules used by wxWidgets itself.
+         This makes it possible to keep separed the object files compiled with
+         different configuration settings.
+    -->
+    <define-global-tag name="set-wxlike-builddir">
+        <!-- note that the builddir for autoconf should always be '.' -->
+        <if cond="FORMAT!='autoconf'">
+            <set var="_BUILDDIR_SHARED_SUFFIX">
+                <if cond="WX_SHARED=='0'"></if>
+                <if cond="WX_SHARED=='1'">_dll</if>
+            </set>
+
+            <set var="BUILDDIR">
+                $(COMPILER)$(WX_PORT)$(WXLIBPOSTFIX)$(_BUILDDIR_SHARED_SUFFIX)
+            </set>
+        </if>
+    </define-global-tag>
+
 </makefile>
index fca2c126c6f1f3d5e02dff4a552caeb210b898bc..324c24a5fa59f9f922a1da945efed333b54821ea 100644 (file)
 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>
+
+        <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_CXXFLAGS">
-            <default-value>`$(DOLLAR)(WX_CONFIG) --cxxflags`</default-value>
-            <description>C++ 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_CPPFLAGS">
-            <default-value>`$(DOLLAR)(WX_CONFIG) --cppflags`</default-value>
-            <description>C preprocessor flags to use with wxWidgets code</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>
-        <option name="WX_RESCOMP">
-            <default-value>`$(DOLLAR)(WX_CONFIG) --rescomp`</default-value>
-            <description>wxWidgets resource compiler and flags</description>
+
+        <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>
index 0f41ec84b30fd0cf7abe082e9a3c1963d722b46c..5f295c629349dec4b75d33c282142fa6bd8cac48 100644 (file)
 <!--                $Id$ -->
 
 
-<!--
-
-FIXME: this template has (at least) the following bugs:
-
- * it's MSW-only, the port is assumed to be wxMSW unconditionally
-
- * multiple wx configurations (CFG variable set when building the
-   library) are not supported
-
--->
-
-<!-- makefile tag signifies the beginning of the bakefile           -->
 <makefile>
 
-    <requires version="0.1.5"/>
+    <requires version="0.2.1"/>
 
     <!--                        OPTIONS                             -->
     <!--                                                            -->
@@ -41,77 +29,12 @@ FIXME: this template has (at least) the following bugs:
     <!--    Note that the above only happens if an option           -->
     <!--    is not constant, i.e. if it cannot be determined        -->
     <!--    by bakefile itself.                                     -->
+    <!--    Also note that for 'autoconf' format these options      -->
+    <!--    are only useful when used together with wxpresets.m4    -->
+    <!--    macro file which contains macros for detecting the      -->
+    <!--    option values for wx-based projects. See wxpresets.m4   -->
+    <!--    comments for more info.    -->
 
-    <!-- Presets for limited dmars make.exe format: -->
-    <if cond="FORMAT=='dmars'">
-        <set var="WX_UNICODE">0</set>
-        <set var="WX_DEBUG">1</set>
-        <set var="WX_SHARED">0</set>
-    </if>
-
-
-    <!--    This is a standard option that determines               -->
-    <!--    whether the user wants to build this library as         -->
-    <!--    a dll or as a static library.                           -->
-    <if cond="not isdefined('WX_SHARED')">
-        <set var="WX_SHARED_DEFAULT" overwrite="0">0</set>
-        <option name="WX_SHARED">
-            <values>0,1</values>
-            <values-description>,DLL</values-description>
-            <default-value>$(WX_SHARED_DEFAULT)</default-value>
-            <description>
-                Use DLL build of wx library to use?
-            </description>
-        </option>
-    </if>
-
-    <!-- Configuration for building the bakefile with               -->
-    <!-- unicode strings or not (unicode or ansi).                  -->
-    <if cond="not isdefined('WX_UNICODE')">
-        <set var="WX_UNICODE_DEFAULT" overwrite="0">0</set>
-        <option name="WX_UNICODE">
-            <values>0,1</values>
-            <values-description>,Unicode</values-description>
-            <default-value>$(WX_UNICODE_DEFAULT)</default-value>
-            <description>
-                Compile Unicode build of wxWidgets?
-            </description>
-        </option>
-    </if>
-
-    <if cond="not isdefined('WX_DEBUG')">
-        <set var="WX_DEBUG_DEFAULT" overwrite="0">1</set>
-        <option name="WX_DEBUG">
-            <values>0,1</values>
-            <values-description>Release,Debug</values-description>
-            <default-value>$(WX_DEBUG_DEFAULT)</default-value>
-            <description>
-                Use debug build of wxWidgets (define __WXDEBUG__)?
-            </description>
-        </option>
-    </if>
-
-    <if cond="not isdefined('WX_VERSION')">
-        <set var="WX_VERSION_DEFAULT" overwrite="0">28</set>
-        <option name="WX_VERSION">
-            <default-value>$(WX_VERSION_DEFAULT)</default-value>
-            <description>
-                Version of the wx library to build against.
-            </description>
-        </option>
-    </if>
-
-    <if cond="not isdefined('WX_MONOLITHIC')">
-        <set var="WX_MONOLITHIC_DEFAULT" overwrite="0">0</set>
-        <option name="WX_MONOLITHIC">
-            <values>0,1</values>
-            <values-description>Multilib,Monolithic</values-description>
-            <default-value>$(WX_MONOLITHIC_DEFAULT)</default-value>
-            <description>
-                Use monolithic build of wxWidgets?
-            </description>
-        </option>
-    </if>
 
 
     <!--                     HELPER VARIABLES                       -->
@@ -135,11 +58,6 @@ FIXME: this template has (at least) the following bugs:
     <!--    These are handy ways of dealing with the                -->
     <!--    extensions in the library names of the                  -->
     <!--    wxWindows library.                                      -->
-    <set var="WXLIBPOSTFIX">
-        <if cond="WX_DEBUG=='1' and WX_UNICODE=='1'">ud</if>
-        <if cond="WX_DEBUG=='1' and WX_UNICODE=='0'">d</if>
-        <if cond="WX_DEBUG=='0' and WX_UNICODE=='1'">u</if>
-    </set>
     <set var="WX3RDPARTYLIBPOSTFIX">
         <if cond="WX_DEBUG=='1'">d</if>
     </set>
@@ -153,11 +71,14 @@ FIXME: this template has (at least) the following bugs:
         <if cond="WX_SHARED=='1'">$(DIRSEP)lib$(DIRSEP)$(COMPILER)$(WXCPU)_dll</if>
     </set>
 
-    <set var="WXPORT">
+    <!-- under Unix this is an option (detected at configure-time);
+         under Windows this is not an user option! -->
+    <set var="WX_PORT">
         <if cond="FORMAT=='msevc4prj'">wince</if>
         <if cond="FORMAT!='msevc4prj'">msw</if>
     </set>
-    <set var="WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WXPORT)$(WXLIBPOSTFIX)</set>
+
+    <set var="WXLIBINCLUDE">$(WXLIBPATH)$(DIRSEP)$(WX_PORT)$(WXLIBPOSTFIX)</set>
 
 
     <!--    All the possible mixes for the wx library names          -->
@@ -173,95 +94,65 @@ FIXME: this template has (at least) the following bugs:
             WX_MONOLITHIC=1, then the base library is translated to the
             monolithic library
         -->
-        <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)</if>
-        <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d</if>
-        <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u</if>
-        <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud</if>
+        <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WX_PORT)$(WX_VERSION)</if>
+        <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WX_PORT)$(WX_VERSION)d</if>
+        <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WX_PORT)$(WX_VERSION)u</if>
+        <if cond="WX_MONOLITHIC=='1' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WX_PORT)$(WX_VERSION)ud</if>
     </set>
 
+
     <!--   Libraries whose name is prefixed with 'wxbase'            -->
-    <set var="WXLIB_NET_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)_net</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d_net</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u_net</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud_net</if>
-    </set>
-    <set var="WXLIB_XML_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)_xml</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d_xml</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u_xml</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud_xml</if>
-    </set>
-    <set var="WXLIB_ODBC_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wxbase$(WX_VERSION)_odbc</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wxbase$(WX_VERSION)d_odbc</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wxbase$(WX_VERSION)u_odbc</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wxbase$(WX_VERSION)ud_odbc</if>
+    <define-global-tag name="define-wxbase-lib-name">
+        <set var="WXLIB_$(value.upper())_NAME">
+            <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">
+                wxbase$(WX_VERSION)_$(value)
+            </if>
+            <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">
+                wxbase$(WX_VERSION)d_$(value)
+            </if>
+            <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">
+                wxbase$(WX_VERSION)u_$(value)
+            </if>
+            <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">
+                wxbase$(WX_VERSION)ud_$(value)
+            </if>
     </set>
+    </define-global-tag>
 
-    <!--   Libraries whose name is prefixed with 'wx' only          -->
-    <set var="WXLIB_CORE_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_core</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_core</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_core</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_core</if>
-    </set>
-    <set var="WXLIB_MEDIA_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_media</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_media</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_media</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_media</if>
-    </set>
-    <set var="WXLIB_XRC_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_xrc</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_xrc</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_xrc</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_xrc</if>
-    </set>
-    <set var="WXLIB_HTML_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_html</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_html</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_html</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_html</if>
-    </set>
-    <set var="WXLIB_ADV_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_adv</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_adv</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_adv</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_adv</if>
-    </set>
-    <set var="WXLIB_QA_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_qa</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_qa</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_qa</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_qa</if>
-    </set>
-    <set var="WXLIB_DBGRID_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_dbgrid</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_dbgrid</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_dbgrid</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_dbgrid</if>
-    </set>
-    <set var="WXLIB_GL_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_gl</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_gl</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_gl</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_gl</if>
-    </set>
-    <set var="WXLIB_AUI_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_aui</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_aui</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_aui</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_aui</if>
-    </set>
-    <set var="WXLIB_RICHTEXT_NAME">
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)_richtext</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)d_richtext</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">wx$(WXPORT)$(WX_VERSION)u_richtext</if>
-        <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">wx$(WXPORT)$(WX_VERSION)ud_richtext</if>
-    </set>
+    <define-wxbase-lib-name>net</define-wxbase-lib-name>
+    <define-wxbase-lib-name>xml</define-wxbase-lib-name>
+    <define-wxbase-lib-name>odbc</define-wxbase-lib-name>
 
 
+    <!--   Libraries whose name is prefixed with 'wx' only          -->
+    <define-global-tag name="define-wxlib-name">
+        <set var="WXLIB_$(value.upper())_NAME">
+            <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='0'">
+                wx$(WX_PORT)$(WX_VERSION)_$(value)
+            </if>
+            <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='0' and WX_DEBUG=='1'">
+                wx$(WX_PORT)$(WX_VERSION)d_$(value)
+            </if>
+            <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='0'">
+                wx$(WX_PORT)$(WX_VERSION)u_$(value)
+            </if>
+            <if cond="WX_MONOLITHIC=='0' and WX_UNICODE=='1' and WX_DEBUG=='1'">
+                wx$(WX_PORT)$(WX_VERSION)ud_$(value)
+            </if>
+        </set>
+    </define-global-tag>
+
+    <define-wxlib-name>core</define-wxlib-name>
+    <define-wxlib-name>media</define-wxlib-name>
+    <define-wxlib-name>xrc</define-wxlib-name>
+    <define-wxlib-name>html</define-wxlib-name>
+    <define-wxlib-name>adv</define-wxlib-name>
+    <define-wxlib-name>qa</define-wxlib-name>
+    <define-wxlib-name>dbgrid</define-wxlib-name>
+    <define-wxlib-name>gl</define-wxlib-name>
+    <define-wxlib-name>aui</define-wxlib-name>
+    <define-wxlib-name>richtext</define-wxlib-name>
+
 
 
 
@@ -306,7 +197,7 @@ FIXME: this template has (at least) the following bugs:
         <!-- wx-lib can be used also to link against contrib libraries
              (which always have the same name, regardless of WX_MONOLITHIC value) -->
         <if cond="value in CONTRIBLIB_LIST.split()">
-            <sys-lib>wx$(WXPORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)</sys-lib>
+            <sys-lib>wx$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)</sys-lib>
         </if>
 
         <if cond="value not in ALLLIB_LIST.split()">
@@ -331,6 +222,8 @@ FIXME: this template has (at least) the following bugs:
             <ldflags>-mthreads</ldflags>
         </if>
 
+        <define>$(substituteFromDict(WX_SHARED,{'1':'WXUSINGDLL','0':''}))</define>
+
         <define>$(WXUNICODE_DEFINE)</define>
         <define>$(WXDEBUG_DEFINE)</define>
         <define>__WXMSW__</define>
@@ -397,4 +290,32 @@ FIXME: this template has (at least) the following bugs:
         <__wx-syslibs/>
     </template>
 
+    <if cond="FORMAT_SUPPORTS_ACTIONS=='1'">
+
+        <!--
+            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 printing the following nice error message...
+                            (much better than the 'could not find wx/*.h file')
+        -->
+        <action id="test_for_selected_wxbuild">
+            <dependency-of>all</dependency-of>
+
+            <!-- the @ is to hide these actions from the user -->
+            <command>
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    echo ----------------------------------------------------------------------------
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    echo Selected wxWidgets build is not available!
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    echo Please use the options prefixed with WX_ to select another wxWidgets build.
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    echo ----------------------------------------------------------------------------
+                @if not exist $(WX_DIR)$(WXLIBINCLUDE)$(DIRSEP)wx$(DIRSEP)setup.h \
+                    exit 1
+            </command>
+        </action>
+    </if>
+
 </makefile>
index a21f271a7218d26aeffcaf0949a16bfc2d3cb4da..2a0152b6b4fd919f0cd76290580cdfadccb8dce2 100644 (file)
@@ -7,6 +7,9 @@
 
     <exe id="minimal" template="wx">
         <app-type>gui</app-type>
+
+        <!-- this sample builds always in debug mode; if you have
+             compiled wxWidgets in release mode, you'll get link errors! -->
         <debug-info>on</debug-info>
         <runtime-libs>dynamic</runtime-libs>