|
Boost-Build : |
From: Jonathan P. Stucklen (stuckj_at_[hidden])
Date: 2006-10-31 20:04:12
Hello,
First off, let me say I'm a relatively new user of bjam v2. I'm using a
boost-build configuration from boost 1.33.0.
I'm converting a relatively large system from a make based build to bjam. The
system consists of several modules shared between projects at my company as
well as several vendor libraries some of which we compile and others of which
we have pre-installed on the system.
While setting up the vendor library configuration for the system, I ran into a
snag. I was trying to setup the jamfiles for each library outside of the
library directory (so as not to pollute the libraries that I'm not supposed to
modify). To do this, I stored the jamfiles for the vendor libraries in their
own directories off of the source root (top/external/<LIBNAME>/Jamfile.v2). I
then used project.act-as-jamfile within the library jamfile. Here's an example:
---SNIP---
import project ;
project.act-as-jamfile $(__name__) : $(VIGRA_LOCATION) ;
cpp_sources = [ glob *.cpp ] ;
lib vigra
: $(cpp_sources)
: <include>.
:
: <include>.
;
---SNIP---
VIGRA_LOCATION I have defined in the Jamroot as a path-constant and points to
the location where the actual library source code is located (in my test case,
it's just in top/<LIBNAME>).
I found that this worked, however the library jamfile did not inherit any
attributes from the top level project (in Jamroot). Specifically, it drove me
nuts because it ignored build-dir. :)
In tracing through the debug output, it looks like the culprit is that
project.act-as-jamfile calls project.initialize without a basename and the
check on line 436-437 for ! $(basename) in project-root.jam Jamroot ...
apparently returns false (is it matching an empty string???). Therefore, the
module is considered to be a project root jamfile and doesn't inherit
attributes.
I'm not sure if this is the desired functionality. But, I was able to make a
patch that allows you to either have this functionality or allow the module to
have a parent. I just added an optional basename parameter to act-as-jamfile
and passed it to the call to initialize in act-as-jamfile. If you call
act-as-jamfile without a basename, it will work as is. If you give it a name
(e.g., Jamfile.v2), it will look for a parent jamfile.
Here's the patch to project.jam:
-----SNIP-----
120c120
< rule act-as-jamfile ( module : location )
--- > rule act-as-jamfile ( module : location : basename ? ) 133c133 < initialize $(module) : $(location) ; --- > initialize $(module) : $(location) : $(basename) ; -----SNIP----- -Johnny
Boost-Build 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