Boost logo

Boost-Build :

Subject: Re: [Boost-build] allowing targets to fail
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2017-04-08 14:13:15


AMDG

On 04/08/2017 06:31 AM, Stefan Seefeld via Boost-build wrote:
>
> I'm still trying to understand how this works...
>
> Consider this little snippet (from example/try_compile/)
>
> obj foo : foo.cpp ;
> exe main : main.cpp : [ check-target-builds foo : <define>FOO=1 :
> <define>FOO=0 ] ;
>
> I can add an "ECHO done parsing ;" at the end of the Jamfile to
> demonstrate that the "check-target-builds" rule isn't executed during
> the parsing. But when is it executed ? Or more generally: what does the
> overall data- and workflow look like ? The "define" feature (or property
> ?) can only be defined once the build result of "foo" is known, which
> seems to rule out that it is done during the normal make stage. Or does it ?
> Could someone please spell out all the build / evaluation stages for the
> above snippet ? When is "foo" built ? When is the "define" property set
> on the "main" target ? Etc. ? And given the above conditional definition
> of properties, what else may be conditionalized on the outcome of a
> target build such as "foo" ?
>

Phase 1: Load Jamfiles
Phase 2: Generate actual targets
Phase 3: Build targets

All properties including check-target-build are handled
in phase 2.

When loading Jamfiles we create a data structure that
looks something like this:

class basic-target {
    # returns a list of targets to build and the usage-requirements
    pair<target-list, property-set> construct(property-set);
}
# Constructing a project builds all targets in the project
class project-target : basic-target {}

# Corresponds to a single named target in a Jamfile
class main-target : basic-target {}

Then pseudo-code for the build looks something like:

project = load-jamfile(".");
(targets, usage-requirements) =
  project.construct(command-line-features);
bjam.update-now $(targets) ;

In Christ,
Steven Watanabe


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