|
Boost-Commit : |
From: jurko.gospodnetic_at_[hidden]
Date: 2008-08-22 22:11:32
Author: jurko
Date: 2008-08-22 22:11:32 EDT (Fri, 22 Aug 2008)
New Revision: 48299
URL: http://svn.boost.org/trac/boost/changeset/48299
Log:
Added a new wxFormBuilder toolset to the Boost Build contrib folder.
Added:
trunk/tools/build/v2/contrib/wxFormBuilder.jam (contents, props changed)
Added: trunk/tools/build/v2/contrib/wxFormBuilder.jam
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/contrib/wxFormBuilder.jam 2008-08-22 22:11:32 EDT (Fri, 22 Aug 2008)
@@ -0,0 +1,196 @@
+################################################################################
+#
+# Copyright (c) 2007-2008 Dario Senic, Jurko Gospodnetic.
+#
+# Use, modification and distribution is subject to the Boost Software
+# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
+# http://www.boost.org/LICENSE_1_0.txt)
+#
+################################################################################
+
+################################################################################
+#
+# Boost Build wxFormBuilder generator tool module.
+#
+# wxFormBuilder is a GUI designer tool for the wxWidgets library. It can then
+# generate C++ sources modeling the designed GUI using the wxWidgets library
+# APIs.
+#
+# This module defines a wxFormBuilder project file type and rules needed to
+# generate C++ source files from those projects. With it you can simply list
+# wxFormBuilder projects as sources for some target and Boost Build will
+# automatically convert them to C++ sources and process from there.
+#
+# The wxFormBuilder executable location may be provided as a parameter when
+# configuring this toolset. Otherwise the default wxFormBuilder.exe executable
+# name is used located in the folder pointed to by the WXFORMBUILDER environment
+# variable.
+#
+# Current limitations:
+#
+# * Works only on Windows.
+# * Works only when run via Boost Jam using the native Windows cmd.exe command
+# interpreter, i.e. the default native Windows Boost Jam build.
+# * Used wxFormBuilder projects need to have their output file names defined
+# consistently with target names assumed by this build script. This means
+# that their target names must use the prefix 'wxFormBuilderGenerated_'.
+#
+################################################################################
+
+################################################################################
+#
+# Implementation note:
+#
+# Avoiding the limitation on the generated target file names can be done but
+# would require depeding on external tools to copy the wxFormBuilder project to
+# a temp location and then modify it in-place to set its target file names. On
+# the other hand wxFormBuilder is expected to add command-line options for
+# choosing the target file names from the command line which will allow us to
+# remove this limitation in a much cleaner way.
+# (23.08.2008.) (Jurko)
+#
+################################################################################
+
+import generators ;
+import os ;
+import path ;
+import toolset ;
+import type ;
+
+
+################################################################################
+#
+# wxFormBuilder.generate()
+# ------------------------
+#
+# Action for processing WX_FORM_BUILDER_PROJECT types.
+#
+################################################################################
+#
+# Implementation note:
+#
+# wxFormBuilder generated CPP and H files need to be moved to the location
+# where the Boost Build target system expects them so that the generated CPP
+# file can be included into the compile process and that the clean rule
+# succesfully deletes both CPP and H files. By default wxFormBuilder generates
+# files in the same location where the provided WX_FORM_BUILDER_PROJECT file is
+# located.
+# (15.05.2007.) (Dario)
+#
+################################################################################
+
+actions generate
+{
+ start "" /wait "$(EXECUTABLE)" /g "$(2)"
+ move "$(2:P)\wxFormBuilderGenerated_$(2:B).cpp" "%CD%\$(1[1]:P)"
+ move "$(2:P)\wxFormBuilderGenerated_$(2:B).h" "%CD%\$(1[1]:P)"
+}
+
+
+################################################################################
+#
+# wxFormBuilder.init()
+# --------------------
+#
+# Main toolset initialization rule called via the toolset.using rule.
+#
+################################################################################
+
+rule init ( executable ? )
+{
+ if $(.initialized)
+ {
+ if $(.debug-configuration)
+ {
+ ECHO notice: [wxFormBuilder] Repeated initialization request
+ (executable \"$(executable:E="")\") detected and ignored. ;
+ }
+ }
+ else
+ {
+ local environmentVariable = WXFORMBUILDER ;
+
+ if $(.debug-configuration)
+ {
+ ECHO notice: [wxFormBuilder] Configuring wxFormBuilder... ;
+ }
+
+ # Deduce the path to the used wxFormBuilder executable.
+ if ! $(executable)
+ {
+ executable = "wxFormBuilder.exe" ;
+ local executable-path = [ os.environ $(environmentVariable) ] ;
+ if $(executable-path)-is-not-empty
+ {
+ executable = [ path.root $(executable) $(executable-path) ] ;
+ }
+ else if $(.debug-configuration)
+ {
+ ECHO notice: [wxFormBuilder] No wxFormBuilder path configured
+ either explicitly or using the $(environmentVariable)
+ environment variable. ;
+ ECHO notice: [wxFormBuilder] To avoid complications please
+ update your configuration to includes a correct path to the
+ wxFormBuilder executable. ;
+ ECHO notice: [wxFormBuilder] wxFormBuilder executable will be
+ searched for on the system path. ;
+ }
+ }
+ if $(.debug-configuration)
+ {
+ ECHO notice: [wxFormBuilder] Will use wxFormBuilder executable
+ \"$(executable)\". ;
+ }
+
+ # Now we are sure we have everything we need to initialize this toolset.
+ .initialized = true ;
+
+ # Store the path to the used wxFormBuilder executable.
+ .executable = $(executable) ;
+
+ # Type registration.
+ type.register WX_FORM_BUILDER_PROJECT : fbp ;
+
+ # Result target definition. Needed for the clean rule to work correctly.
+ type.set-generated-target-prefix CPP : : "wxFormBuilderGenerated_" ;
+ type.set-generated-target-prefix H : : "wxFormBuilderGenerated_" ;
+
+ # Parameters to be forwarded to the action rule.
+ toolset.flags wxFormBuilder.generate EXECUTABLE : $(.executable) ;
+
+ # Generator definition and registration.
+ generators.register-standard wxFormBuilder.generate :
+ WX_FORM_BUILDER_PROJECT : CPP H ;
+ }
+}
+
+
+################################################################################
+#
+# wxFormBuilder.is-initialized()
+# ------------------------------
+#
+# Returns whether this toolset has been initialized.
+#
+################################################################################
+
+rule is-initialized ( )
+{
+ return $(.initialized) ;
+}
+
+
+################################################################################
+#
+# Startup code executed when loading this module.
+#
+################################################################################
+
+# Global variables for this module.
+.executable = ;
+.initialized = ;
+
+if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
+{
+ .debug-configuration = true ;
+}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk