|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53616 - trunk/tools/build/v2/tools
From: ghost_at_[hidden]
Date: 2009-06-04 02:14:56
Author: vladimir_prus
Date: 2009-06-04 02:14:55 EDT (Thu, 04 Jun 2009)
New Revision: 53616
URL: http://svn.boost.org/trac/boost/changeset/53616
Log:
Add new 'convert' main target
Added:
trunk/tools/build/v2/tools/convert.jam (contents, props changed)
Text files modified:
trunk/tools/build/v2/tools/builtin.jam | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Modified: trunk/tools/build/v2/tools/builtin.jam
==============================================================================
--- trunk/tools/build/v2/tools/builtin.jam (original)
+++ trunk/tools/build/v2/tools/builtin.jam 2009-06-04 02:14:55 EDT (Thu, 04 Jun 2009)
@@ -30,6 +30,7 @@
import utility ;
import virtual-target ;
import message ;
+import convert ;
# FIXME: the following generate module import is not needed here but removing it
# too hastly will break using code (e.g. the main Boost library Jamroot file)
Added: trunk/tools/build/v2/tools/convert.jam
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/tools/convert.jam 2009-06-04 02:14:55 EDT (Thu, 04 Jun 2009)
@@ -0,0 +1,62 @@
+# Copyright (c) 2009 Vladimir Prus
+#
+# 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)
+
+# Implements 'convert' target that takes a bunch of source and
+# tries to convert each one to the specified type.
+#
+# For example:
+#
+# convert objects obj : a.cpp b.cpp ;
+#
+
+import targets ;
+import generators ;
+import project ;
+import type ;
+import "class" : new ;
+
+class convert-target-class : typed-target
+{
+ rule __init__ ( name : project : type
+ : sources * : requirements * : default-build * : usage-requirements * )
+ {
+ typed-target.__init__ $(name) : $(project) : $(type)
+ : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ;
+ }
+
+ rule construct ( name : source-targets * : property-set )
+ {
+ local r = [ generators.construct $(self.project) : $(self.type)
+ : [ property-set.create [ $(property-set).raw ] # [ feature.expand
+ <main-target-type>$(self.type) ]
+ # ]
+ : $(source-targets) ] ;
+ if ! $(r)
+ {
+ errors.error "unable to construct" [ full-name ] ;
+ }
+
+ return $(r) ;
+ }
+
+}
+
+rule convert ( name type : sources * : requirements * : default-build *
+ : usage-requirements * )
+{
+ local project = [ project.current ] ;
+
+ # This is a circular module dependency, so it must be imported here
+ modules.import targets ;
+ targets.main-target-alternative
+ [ new convert-target-class $(name) : $(project) : [ type.type-from-rule-name $(type) ]
+ : [ targets.main-target-sources $(sources) : $(name) ]
+ : [ targets.main-target-requirements $(requirements) : $(project) ]
+ : [ targets.main-target-default-build $(default-build) : $(project) ]
+ : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
+ ] ;
+}
+IMPORT $(__name__) : convert : : convert ;
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