$include_dir="/home/hyper-archives/boost-build/include"; include("$include_dir/msg-header.inc") ?>
From: Craig Rodrigues (rodrigc_at_[hidden])
Date: 2005-04-21 11:50:42
Hi,
I would like to submit the following patch, which was
developed by my colleague Alexander Kabaev <kan_at_[hidden]>.
We use this patch to Boost Build, in order to help us
specifiy the directories where source files are located
on a per-project basis. I have attached the patch, and
a testcase, where the source files for a project are
in multiple directories.
This basically achieves for me what I would have
used VPATH in GNU make for.
Thanks for your consideration.
--
Craig Rodrigues
rodrigc_at_[hidden]
diff -ur /home/crodrigu/boost-build/build/project.jam /usr/snapshots/akabaev/boost-build/build/project.jam
--- /home/crodrigu/boost-build/build/project.jam 2005-03-20 14:00:43.000000000 -0500
+++ /usr/snapshots/akabaev/boost-build/build/project.jam 2005-04-15 18:58:52.276845512 -0400
@@ -541,9 +541,13 @@
self.default-build = [ property.make $(specification) ] ;
}
else if $(attribute) = "source-location"
- {
- self.source-location = [ path.root
- [ path.make $(specification) ] $(self.location) ] ;
+ {
+ self.source-location = ;
+ for local src-path in $(specification)
+ {
+ self.source-location += [ path.root
+ [ path.make $(src-path) ] $(self.location) ] ;
+ }
}
else if $(attribute) = "build-dir"
{
diff -ur /home/crodrigu/boost-build/build/targets.jam /usr/snapshots/akabaev/boost-build/build/targets.jam
--- /home/crodrigu/boost-build/build/targets.jam 2005-03-20 14:00:43.000000000 -0500
+++ /usr/snapshots/akabaev/boost-build/build/targets.jam 2005-04-15 20:26:03.838527248 -0400
@@ -783,23 +783,48 @@
rule generate ( properties )
{
return [ property-set.empty ]
- [ virtual-target.from-file $(self.name) : $(self.project) ] ;
+ [ virtual-target.from-file $(self.name)
+ : [ location ]
+ : $(self.project) ] ;
}
# Returns true if the referred file really exists;
rule exists ( )
{
- local location = [ path.root $(self.name)
- [ $(self.project).get source-location ] ] ;
- return [ CHECK_IF_FILE [ path.native $(location) ] ] ;
- }
-
+ return [ CHECK_IF_FILE [ path.native [ location ] ] ] ;
+ }
+
# Returns the location of target. Needed by 'testing.jam'
rule location ( )
{
- return [ path.root $(self.name)
- [ $(self.project).get source-location ] ] ;
- }
+ if $(self.file-location)
+ {
+ return $(self.file-location) ;
+ }
+ else
+ {
+ local source-location = [ $(self.project).get source-location ] ;
+
+ for local src-dir in $(source-location)
+ {
+ if ! $(self.file-location)
+ {
+ local location = [ path.root $(self.name) $(src-dir) ] ;
+ if [ CHECK_IF_FILE [ path.native $(location) ] ]
+ {
+ self.file-location = $(location) ;
+ }
+ }
+ }
+ if ! $(self.file-location)
+ {
+ self.file-location = [ path.root $(self.name)
+ $(source-location[1]) ] ;
+ }
+ }
+
+ return $(self.file-location) ;
+ }
}
diff -ur /home/crodrigu/boost-build/build/virtual-target.jam /usr/snapshots/akabaev/boost-build/build/virtual-target.jam
--- /home/crodrigu/boost-build/build/virtual-target.jam 2005-03-20 14:00:43.000000000 -0500
+++ /usr/snapshots/akabaev/boost-build/build/virtual-target.jam 2005-04-15 20:34:57.312426888 -0400
@@ -525,10 +525,14 @@
}
else
{
+ local source-location = ;
+ for local source-dir in [ $(self.project).get source-location ]
+ {
+ source-location += [ path.native $(source-dir) ] ;
+ }
# This is a source file.
- SEARCH on $(target) =
- [ path.native [ $(self.project).get source-location ] ] ;
- }
+ SEARCH on $(target) = $(source-location) ;
+ }
}
# Returns the directory for this target
@@ -749,15 +753,14 @@
# FIXME: more correct way would be to compute path to the file, based on name and source location
# for the project, and use that path to determine if the target was already created.
# TODO: passing project with all virtual targets starts to be annoying.
-rule from-file ( file : project )
+rule from-file ( file : file-loc : project )
{
import type ; # had to do this here to break a circular dependency
# Check if we've created a target corresponding to this file.
local source-location = [ $(project).get source-location ] ;
- local path = [ path.root [ path.root [ path.make $(file) ] $(source-location) ]
- [ path.pwd ] ] ;
-
+ local path = [ path.root $(file-loc) [ path.pwd ] ] ;
+
if $(.files.$(path))
{
return $(.files.$(path)) ;
--G4iJoqBmSsgzjUCe Content-Type: application/octet-stream
Content-Disposition: attachment; filename="testproject.zip"
Content-Transfer-Encoding: base64
[Attachment content not displayed.] --G4iJoqBmSsgzjUCe--