Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-06 09:28:22


----- Original Message -----
From: "Douglas Gregor" <gregod_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, January 06, 2002 12:16 AM
Subject: Re: [boost] Build system: building form outside the source
directory

> On Saturday 05 January 2002 07:57 pm, you wrote:
> > Based on the above, I don't think your fix is quite right. I'm not sure
> > that everything in the Jam code will account properly for an
> > explicitly-specified Jamfile out-of-the-box, but you should probably try
> > again without setting TOP in the command-line.
>
> Here's attempt #2, trying to avoid setting TOP on the command-line. You
> mentioned project-root, but frankly the project-root doesn't do all that
much:
>
> rule project-root
> {
> SubDir TOP ;
> }
>
> It seems that BOOST_ROOT should show up somehow if we're declaring that
the
> current Jamfile is at $(BOOST_ROOT)/Jamfile. If we look at the part of
> SubDir that is supposed to set TOP, we have:
>
> if ! $($(<[1]))
> {
> if ! $(<[1])
> {
> EXIT SubDir syntax error ;
> }
>
> $(<[1]) = [ FSubDir $(<[2-]) ];
> $(<[1])_TOKENS = [ split-path $($(<[1])) ] ;
> gTOP = $(<[1]) ; # not sure why someone would want to use
anything
> # other than TOP, but just in case...
> }
>
> Where $(<) is going to be TOP. $(<[2-]) will, of course, be empty, so
$(TOP)
> will _always_ get set to just "."
> Furthermore, even if $(<[2-]) had some form of path in there, we would
only
> be getting the subdirectory from that path back to the root ("/").
>
> As an experiment, I performed the following changes. First we make
> project-root look like this:
>
> rule project-root
> {
> SubDir TOP $(BOOST_ROOT) ;
> }

Doug,

I really think you're barking up the wrong tree, here. BOOST_ROOT is mostly
incidental to the build system, except that as a shortcut we allow the
build system directory to be found automatically based on the user having
set BOOST_ROOT. In principle, the build system should be usable for other
projects without any BOOST_ROOT setting.

What you want to do is to get SEARCH_SOURCE to be set to $(JAMFILE:P) by
default, and make sure that all source files have SEARCH set to
SEARCH_SOURCE.

> and then we make the above block of SubDir look like this:
>
> if ! $($(<[1]))
> {
> if ! $(<[1])
> {
> EXIT SubDir syntax error ;
> }
>
> $(<[1]) = $(<[2-]) ;
> $(<[1])_TOKENS = [ split-path $($(<[1])) ] ;
> gTOP = $(<[1]) ; # not sure why someone would want to use
anything
> # other than TOP, but just in case...
> }
>
> Now, when we see project-root, TOP = $(BOOST_ROOT) and
> TOP_TOKENS = [ split-path $(BOOST_ROOT) ]
>
> This actually does work, though there is one thing I'd surely like to
change:
> instead of passing $(BOOST_ROOT) to the subdir command, we should be
passing
> the directory in which the Jamfile containing the project-root command
> resides. Perhaps this is $(JAMFILE:D)?

Now you're talking!

> Anyway, with the above two changes (context diff below), I can build
> out-of-source, out-of-target with:
>
> jam -sALL_LOCATE_TARGET=/path/to/put/binaries
> -sJAMFILE=/path/to/boost/root/Jamfile
>
> Getting closer, I hope?

Yes, that's a lot closer, but you should follow your instinct of using
$(JAMFILE:D) (or $(JAMFILE:P) -- they are equivalent in most contexts).

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk