Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52098 - in trunk/tools/build/v2/example/built_tool: . core tblgen
From: ghost_at_[hidden]
Date: 2009-04-01 02:34:40


Author: vladimir_prus
Date: 2009-04-01 02:34:39 EDT (Wed, 01 Apr 2009)
New Revision: 52098
URL: http://svn.boost.org/trac/boost/changeset/52098

Log:
Add example of using built tool.

Added:
   trunk/tools/build/v2/example/built_tool/
   trunk/tools/build/v2/example/built_tool/Jamroot.jam (contents, props changed)
   trunk/tools/build/v2/example/built_tool/core/
   trunk/tools/build/v2/example/built_tool/core/Jamfile.jam (contents, props changed)
   trunk/tools/build/v2/example/built_tool/core/a.td (contents, props changed)
   trunk/tools/build/v2/example/built_tool/core/core.cpp (contents, props changed)
   trunk/tools/build/v2/example/built_tool/readme.txt (contents, props changed)
   trunk/tools/build/v2/example/built_tool/tblgen/
   trunk/tools/build/v2/example/built_tool/tblgen/Jamfile.jam (contents, props changed)
   trunk/tools/build/v2/example/built_tool/tblgen/tblgen.cpp (contents, props changed)

Added: trunk/tools/build/v2/example/built_tool/Jamroot.jam
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/example/built_tool/Jamroot.jam 2009-04-01 02:34:39 EDT (Wed, 01 Apr 2009)
@@ -0,0 +1,8 @@
+
+import feature ;
+
+feature.feature tblgen : : dependency free ;
+
+project built_tool ;
+
+build-project core ;
\ No newline at end of file

Added: trunk/tools/build/v2/example/built_tool/core/Jamfile.jam
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/example/built_tool/core/Jamfile.jam 2009-04-01 02:34:39 EDT (Wed, 01 Apr 2009)
@@ -0,0 +1,30 @@
+
+import toolset ;
+
+project : requirements <tblgen>../tblgen//tblgen ;
+
+
+# Create a.c using a custom action defined below.
+make a.c : a.td : @tblgen ;
+
+# Use a.c in executable.
+exe core : core.cpp a.c ;
+
+# The action has to invoke the tool built in other
+# parts of the project. The <tblgen> feature is used
+# to specify the location of the tool, and the flags
+# statement below make the full path to the tool
+# available inside the action.
+toolset.flags tblgen COMMAND <tblgen> ;
+
+# We generally want a.c to be rebuilt when the tool changes.
+rule tblgen ( targets * : sources * : properties * )
+{
+ DEPENDS $(targets) : [ on $(targets) return $(COMMAND) ] ;
+}
+
+# The action that invokes the tool
+actions tblgen bind COMMAND
+{
+ $(COMMAND:E=tblgen) > $(<)
+}

Added: trunk/tools/build/v2/example/built_tool/core/a.td
==============================================================================

Added: trunk/tools/build/v2/example/built_tool/core/core.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/example/built_tool/core/core.cpp 2009-04-01 02:34:39 EDT (Wed, 01 Apr 2009)
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}

Added: trunk/tools/build/v2/example/built_tool/readme.txt
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/example/built_tool/readme.txt 2009-04-01 02:34:39 EDT (Wed, 01 Apr 2009)
@@ -0,0 +1,5 @@
+
+This example shows how to build an executable and then use it
+for generating other targets. The 'tblgen' subdirectory builds
+a tool, while the 'core' subdirectory uses that tool. Refer
+to core/Jamfile.jam for detailed comments.
\ No newline at end of file

Added: trunk/tools/build/v2/example/built_tool/tblgen/Jamfile.jam
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/example/built_tool/tblgen/Jamfile.jam 2009-04-01 02:34:39 EDT (Wed, 01 Apr 2009)
@@ -0,0 +1,4 @@
+
+project : requirements -<tblgen>tblgen//tblgen ;
+
+exe tblgen : tblgen.cpp ;
\ No newline at end of file

Added: trunk/tools/build/v2/example/built_tool/tblgen/tblgen.cpp
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/example/built_tool/tblgen/tblgen.cpp 2009-04-01 02:34:39 EDT (Wed, 01 Apr 2009)
@@ -0,0 +1,9 @@
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "int foo;\n";
+ return 0;
+}
+


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