Boost logo

Boost-Commit :

From: steven_at_[hidden]
Date: 2008-05-12 17:21:29


Author: steven_watanabe
Date: 2008-05-12 17:21:29 EDT (Mon, 12 May 2008)
New Revision: 45309
URL: http://svn.boost.org/trac/boost/changeset/45309

Log:
Added missing local file
Added:
   sandbox/tools/profile_templates/template-profile.jam (contents, props changed)

Added: sandbox/tools/profile_templates/template-profile.jam
==============================================================================
--- (empty file)
+++ sandbox/tools/profile_templates/template-profile.jam 2008-05-12 17:21:29 EDT (Mon, 12 May 2008)
@@ -0,0 +1,130 @@
+# template-profile.jam
+#
+# Copyright (c) 2008
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+import feature ;
+import toolset ;
+import type ;
+import errors ;
+import path ;
+import modules ;
+import generators ;
+import "class" ;
+
+module-location = [ path.parent [ path.make [ modules.binding template-profile ] ] ] ;
+
+INSTRUMENT-ACTION = perl [ path.native [ path.join $(module-location) preprocess.pl ] ] ;
+
+type.register INSTRUMENTED_TEMPLATE_PREPROCESSED_CPP : : CPP ;
+type.register RAW_TEMPLATE_PROFILE : rtp ;
+type.register TEMPLATE_PROFILE : template-profile ;
+
+generators.register-standard template-profile.preprocess : CPP : INSTRUMENTED_TEMPLATE_PREPROCESSED_CPP ;
+
+feature.feature <template-profile-toolset> : msvc gcc : free ;
+
+toolset.flags template-profile.preprocess PREPROCESS-ACTION <template-profile-toolset>msvc : cl /E ;
+toolset.flags template-profile.preprocess PREPROCESS-ACTION <template-profile-toolset>gcc : g++ -E ;
+toolset.flags template-profile.preprocess INCLUDE-COMMAND <template-profile-toolset>msvc : /I ;
+toolset.flags template-profile.preprocess INCLUDE-COMMAND <template-profile-toolset>gcc : -I ;
+toolset.flags template-profile.preprocess INCLUDES <include> ;
+
+actions preprocess {
+ "$(PREPROCESS-ACTION)" "$(INCLUDE-COMMAND)$(INCLUDES)" "$(>)" | "$(INSTRUMENT-ACTION)" >"$(<)"
+}
+
+class warn-generator : generator {
+
+ import template-profile ;
+
+ rule __init__ ( ) {
+ generator.__init__ template-profile.build-generic : INSTRUMENTED_TEMPLATE_PREPROCESSED_CPP : RAW_TEMPLATE_PROFILE ;
+ }
+ rule run ( project name : properties : sources * : multiple ? ) {
+ local toolset = [ $(properties).get <toolset> ] ;
+ if ! $(toolset) {
+ errors.error "No toolset specified" ;
+ }
+ switch $(toolset) {
+ case msvc* :
+ toolset = msvc ;
+ case gcc* :
+ toolset = gcc ;
+ case * :
+ errors.error unrecognized toolset $(toolset) ;
+ }
+ local self-dir = [ modules.peek template-profile : module-location ] ;
+ local new-properties = [ $(properties).add-raw <template-profile-toolset>$(toolset) <include>$(self-dir) ] ;
+ return [ generator.run $(project) $(name) : $(new-properties) : $(sources) : $(multiple) ] ;
+ }
+}
+
+generators.register [ class.new warn-generator ] ;
+
+toolset.flags template-profile.build-generic INVOCATION-COMMAND <template-profile-toolset>msvc : cl /W4 /c /D PROFILE_TEMPLATES ;
+toolset.flags template-profile.build-generic INCLUDE-COMMAND <template-profile-toolset>msvc : /I ;
+
+toolset.flags template-profile.build-generic INVOCATION-COMMAND <template-profile-toolset>gcc : g++ -Wall -c -D PROFILE_TEMPLATES ;
+toolset.flags template-profile.build-generic INCLUDE-COMMAND <template-profile-toolset>gcc : -I ;
+
+toolset.flags template-profile.build-generic INCLUDES <include> ;
+
+actions build-generic {
+ $(INVOCATION-COMMAND) "$(INCLUDE-COMMAND)$(INCLUDES)" "$(>)" >"$(<)" 2>&1
+}
+
+class final-profile-generator : generator {
+
+ import targets ;
+ import template-profile ;
+ import path ;
+ import modules ;
+
+ rule __init__ ( ) {
+ generator.__init__ template-profile.process-raw-profile : RAW_TEMPLATE_PROFILE : TEMPLATE_PROFILE ;
+ }
+ rule run ( project name : properties : sources * : multiple ? ) {
+
+ current_path = [ modules.peek template-profile : module-location ] ;
+
+ local postprocess-main-target = [ targets.resolve-reference [ path.join $(current_path) src ] : $(project) ] ;
+ postprocess-main-target = [ $(postprocess-main-target[1]).main-target postprocess ] ;
+ local postprocess-binary-dependencies = [ $(postprocess-main-target).generate [ $(properties).propagated ] ] ;
+ postprocess-binary-dependencies = $(postprocess-binary-dependencies[2-]) ;
+ local postprocess-binary = ;
+
+ for local target in $(postprocess-binary-dependencies) {
+ if [ $(target).type ] = EXE {
+ postprocess-binary =
+ [ path.native
+ [ path.join
+ [ $(target).path ]
+ [ $(target).name ]
+ ]
+ ] ;
+ }
+ }
+
+ if ! $(postprocess-binary) {
+ errors.error Could not find postprocessor binary ;
+ }
+
+ local new-properties = [ $(properties).add-raw <dependency>$(postprocess-binary-dependencies) <postprocess-binary>$(postprocess-binary) ] ;
+ return [ generator.run $(project) $(name) : $(new-properties) : $(sources) : $(multiple) ] ;
+ }
+}
+
+generators.register [ class.new final-profile-generator ] ;
+
+feature.feature <postprocess-binary> : : path incidental ;
+
+toolset.flags template-profile.process-raw-profile POSTPROCESS-BINARY <postprocess-binary> ;
+
+actions process-raw-profile {
+ "$(POSTPROCESS-BINARY)" <"$(>)" >"$(<)"
+}


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