+
+
+
+ <!-- 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 GUI applications -->
+ <template id="wxgui" template="wx">
+ <app-type>gui</app-type>
+ </template>
+
+ <!-- Template for building wx-based console applications -->
+ <template id="wxconsole" template="wx">
+ <app-type>console</app-type>
+ </template>
+
+
+
+ <!-- UTILITY TAGS -->
+ <!-- -->
+
+ <!-- private helper tag: does the same thing as for <set-wxlike> except that:
+ - the variable created is always named "__temp"
+ - can be used (only) inside targets as this is a non-global tag
+ -->
+ <define-tag name="__setlibname" rules="lib,dll,module,exe">
+ <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 current target a directory
+ called "$(value)/$(COMPILER)_lib|dll", just like wxWidgets does.
+ This makes it possible to keep separed the libraries/exes compiled with
+ different compilers and with a different value for WX_SHARED.
+ -->
+ <define-tag name="wxlike-dirname" rules="lib,dll,exe,module">
+ <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">
+ $(value)/$(COMPILER)_$(_DIRNAME_SHARED_SUFFIX)
+ </set>
+
+ <dirname>$(_DIRNAME)</dirname>
+
+ <if cond="FORMAT_SUPPORTS_ACTIONS=='1'">
+ <set var="__mkdir_tgt">make_dir_$(id)</set>
+
+ <add-target target="$(__mkdir_tgt)" type="action"/>
+ <modify-target target="$(__mkdir_tgt)">
+ <command cond="TOOLSET=='unix'">
+ @mkdir -p $(_DIRNAME)
+ </command>
+ <command cond="TOOLSET in ['win32','os2','dos']">
+ if not exist $(nativePaths(_DIRNAME)) mkdir $(nativePaths(_DIRNAME))
+ </command>
+ </modify-target>
+
+ <!-- the following code is mostly equivalent to a:
+ <dependency-of>$(id)</dependency-of>
+ put into the __mkdir_tgt target, except that it does _prepend_
+ the __mkdir_tgt dependency instead of appending it.
+
+ This is required because some compilers (e.g. MSVC) need to store in the
+ output folder some files (e.g. the PDB file) while compiling and thus
+ the library output folder must have been created before _any_ source file
+ is compiled, not just before the library is linked.
+ -->
+ <modify-target target="$(id)">
+ <set var="__deps" prepend="1">
+ $(substitute(__mkdir_tgt, lambda x: ref('__depname', x), 'DEP'))
+ </set>
+ </modify-target>
+ </if>
+ </if>
+ <if cond="FORMAT=='autoconf'">
+ <set var="_DIRNAME">$(value)</set>
+ <dirname>$(_DIRNAME)</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' and FORMAT!='gnu'">
+ <!-- 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>
+
+
+
+ <!-- UTILITY GLOBAL TAGS -->
+ <!-- -->
+
+ <!-- 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>
+
+ <!-- Sets a variable with the name of the 'var' attribute value using the
+ same rules used for wxWidgets library naming.
+ E.g.
+
+ <set-wxlike var='MYMODULE_LIBNAME' prefix='mylib'>
+ mymodule
+ </set-wxlike>
+
+ This tag also supports a 'cond' attribute making it very powerful
+ for conditional linking a wx-based library:
+
+ <option name="USE_MYMODULE">
+ <values>0,1</values>
+ </option>
+ <set-wxlike var='MYMODULE_DEP'
+ prefix='mylib'
+ cond="USE_MYMODULE=='1'">
+ mymodule
+ </set-wxlike>
+ ...
+ <exe id="myexe">
+ <sys-lib>$(MYMODULE_DEP)</sys-lib>
+ </exe>
+ -->
+ <define-global-tag name="set-wxlike">
+ <if cond="FORMAT!='autoconf' and FORMAT!='gnu'">
+ <if cond="'cond' not in attributes">
+ <set var="$(attributes['var'])">
+ $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
+ </set>
+ </if>
+ <if cond="'cond' in attributes">
+ <set var="$(attributes['var'])">
+ <if cond="$(attributes['cond'])">
+ $(attributes['prefix'])_$(WX_PORT)$(WX_VERSION)$(WXLIBPOSTFIX)_$(value)
+ </if>
+ </set>
+ </if>
+ </if>
+
+ <if cond="FORMAT=='autoconf' or FORMAT=='gnu'">
+ <if cond="'cond' not in attributes">
+ <set var="$(attributes['var'])">
+ $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
+ </set>
+ </if>
+ <if cond="'cond' in attributes">
+ <set var="$(attributes['var'])">
+ <if cond="$(attributes['cond'])">
+ $(attributes['prefix'])_$(WX_PORT)$(WXLIBPOSTFIX)_$(value)-$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
+ </if>
+ </set>
+ </if>
+ </if>
+ </define-global-tag>
+