diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-04-19 09:24:38 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-04-19 15:25:50 +0200 |
commit | fc18a6dc1fcb02b505f07914e484cebbaf268698 (patch) | |
tree | 2cb9b04c5924dfd46e7d934912b41c3efd894a93 /build2/bin/target.cxx | |
parent | ae20570f2ad55b2fa8e71cf450457cb9c4b21b1b (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/bin/target.cxx')
-rw-r--r-- | build2/bin/target.cxx | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/build2/bin/target.cxx b/build2/bin/target.cxx index ed36f80..b0ce6d5 100644 --- a/build2/bin/target.cxx +++ b/build2/bin/target.cxx @@ -13,10 +13,14 @@ namespace build2 constexpr const char ext_var[] = "extension"; static target* - obja_factory (const target_type&, dir_path d, string n, const string* e) + obja_factory (const target_type&, + dir_path dir, + dir_path out, + string n, + const string* e) { - obj* o (targets.find<obj> (d, n)); - obja* a (new obja (move (d), move (n), e)); + obj* o (targets.find<obj> (dir, out, n)); + obja* a (new obja (move (dir), move (out), move (n), e)); if ((a->group = o)) o->a = a; @@ -36,10 +40,14 @@ namespace build2 }; static target* - objso_factory (const target_type&, dir_path d, string n, const string* e) + objso_factory (const target_type&, + dir_path dir, + dir_path out, + string n, + const string* e) { - obj* o (targets.find<obj> (d, n)); - objso* so (new objso (move (d), move (n), e)); + obj* o (targets.find<obj> (dir, out, n)); + objso* so (new objso (move (dir), move (out), move (n), e)); if ((so->group = o)) o->so = so; @@ -59,11 +67,15 @@ namespace build2 }; static target* - obj_factory (const target_type&, dir_path d, string n, const string* e) + obj_factory (const target_type&, + dir_path dir, + dir_path out, + string n, + const string* e) { - obja* a (targets.find<obja> (d, n)); - objso* so (targets.find<objso> (d, n)); - obj* o (new obj (move (d), move (n), e)); + obja* a (targets.find<obja> (dir, out, n)); + objso* so (targets.find<objso> (dir, out, n)); + obj* o (new obj (move (dir), move (out), move (n), e)); if ((o->a = a)) a->group = o; @@ -108,12 +120,16 @@ namespace build2 }; static target* - liba_factory (const target_type& t, dir_path d, string n, const string* e) + liba_factory (const target_type& t, + dir_path d, + dir_path o, + string n, + const string* e) { // Only link-up to the group if the types match exactly. // - lib* l (t == liba::static_type ? targets.find<lib> (d, n) : nullptr); - liba* a (new liba (move (d), move (n), e)); + lib* l (t == liba::static_type ? targets.find<lib> (d, o, n) : nullptr); + liba* a (new liba (move (d), move (o), move (n), e)); if ((a->group = l)) l->a = a; @@ -145,12 +161,16 @@ namespace build2 }; static target* - libso_factory (const target_type& t, dir_path d, string n, const string* e) + libso_factory (const target_type& t, + dir_path d, + dir_path o, + string n, + const string* e) { // Only link-up to the group if the types match exactly. // - lib* l (t == libso::static_type ? targets.find<lib> (d, n) : nullptr); - libso* so (new libso (move (d), move (n), e)); + lib* l (t == libso::static_type ? targets.find<lib> (d, o, n) : nullptr); + libso* so (new libso (move (d), move (o), move (n), e)); if ((so->group = l)) l->so = so; @@ -179,11 +199,15 @@ namespace build2 } static target* - lib_factory (const target_type&, dir_path d, string n, const string* e) + lib_factory (const target_type&, + dir_path d, + dir_path o, + string n, + const string* e) { - liba* a (targets.find<liba> (d, n)); - libso* so (targets.find<libso> (d, n)); - lib* l (new lib (move (d), move (n), e)); + liba* a (targets.find<liba> (d, o, n)); + libso* so (targets.find<libso> (d, o, n)); + lib* l (new lib (move (d), move (o), move (n), e)); if ((l->a = a)) a->group = l; |