aboutsummaryrefslogtreecommitdiff
path: root/build2/prerequisite
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-19 09:24:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-19 15:25:50 +0200
commitfc18a6dc1fcb02b505f07914e484cebbaf268698 (patch)
tree2cb9b04c5924dfd46e7d934912b41c3efd894a93 /build2/prerequisite
parentae20570f2ad55b2fa8e71cf450457cb9c4b21b1b (diff)
Redesign src/out scoping
We no longer enter paths from the src tree into scope map. Instead, targets from the src tree now include their out tree directory (in essence their "configuration"). This is then used to find a target's scope. See the comment in class target for details. The result of this change is that we can now again build multiple configurations (out trees) for same project at once.
Diffstat (limited to 'build2/prerequisite')
-rw-r--r--build2/prerequisite37
1 files changed, 22 insertions, 15 deletions
diff --git a/build2/prerequisite b/build2/prerequisite
index baaaf3f..f316fb5 100644
--- a/build2/prerequisite
+++ b/build2/prerequisite
@@ -27,8 +27,8 @@ namespace build2
typedef build2::scope scope_type;
mutable const string* proj; // Can be NULL, from project_name_pool.
- target_key tk;
- mutable scope_type* scope; // Can be NULL if tk.dir is absolute.
+ target_key tk; // .dir and .out can be relative.
+ mutable scope_type* scope; // Can be NULL if tk.dir is absolute.
};
inline bool
@@ -51,38 +51,44 @@ namespace build2
typedef build2::target_type target_type_type;
typedef build2::scope scope_type;
+ // Note that unlike targets, for prerequisites an empty out directory
+ // means undetermined rather than being definitely in the out tree.
+ //
+ const string* const proj; // NULL if not project-qualified.
+ const target_type_type& type;
+ const dir_path dir; // Normalized absolute or relative (to scope).
+ const dir_path out; // Empty, normalized absolute, or relative.
+ const string name;
+ const string* ext; // NULL if unspecified.
+ scope_type& scope;
+ target_type* target; // NULL if not yet resolved. Note that this should
+ // always be the "primary target", not a member of
+ // a target group.
+
+ public:
prerequisite (const string* p,
const target_type_type& t,
dir_path d,
+ dir_path o,
string n,
const string* e,
scope_type& s)
: proj (p),
type (t),
dir (move (d)),
+ out (move (o)),
name (move (n)),
ext (e),
scope (s),
target (nullptr) {}
- public:
- const string* const proj; // NULL if not project-qualified.
- const target_type_type& type;
- const dir_path dir; // Normalized absolute or relative (to scope).
- const string name;
- const string* ext; // NULL if unspecified.
- scope_type& scope;
- target_type* target; // NULL if not yet resolved. Note that this should
- // always be the "primary target", not a member of
- // a target group.
-
// Note that the returned key "tracks" the prerequisite; that is, any
// updates to the prerequisite's members will be reflected in the key.
//
prerequisite_key
key () const
{
- return prerequisite_key {proj, {&type, &dir, &name, ext}, &scope};
+ return prerequisite_key {proj, {&type, &dir, &out, &name, ext}, &scope};
}
public:
@@ -113,6 +119,7 @@ namespace build2
insert (const string* proj,
const target_type&,
dir_path dir,
+ dir_path out,
string name,
const string* ext,
scope&,
@@ -121,7 +128,7 @@ namespace build2
pair<prerequisite&, bool>
insert (const string* proj, const target_key& tk, scope& s, tracer& t)
{
- return insert (proj, *tk.type, *tk.dir, *tk.name, tk.ext, s, t);
+ return insert (proj, *tk.type, *tk.dir, *tk.out, *tk.name, tk.ext, s, t);
}
};
}