From fc18a6dc1fcb02b505f07914e484cebbaf268698 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 19 Apr 2016 09:24:38 +0200 Subject: 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. --- build2/cxx/compile.cxx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'build2/cxx/compile.cxx') diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx index 914cd10..b7577d4 100644 --- a/build2/cxx/compile.cxx +++ b/build2/cxx/compile.cxx @@ -679,9 +679,19 @@ namespace build2 // purposes: it is only important for us to accurately determine // target types for headers that could be auto-generated. // - scope& b (scopes.find (d)); - if (b.root_scope () != nullptr) - tt = map_extension (b, n, *e); + // While at it also try to determine if this target is from the src + // or out tree of said project. + // + dir_path out; + + scope& bs (scopes.find (d)); + if (bs.root_scope () != nullptr) + { + tt = map_extension (bs, n, *e); + + if (bs.out_path () != bs.src_path () && d.sub (bs.src_path ())) + out = out_src (d, bs); + } // If it is outside any project, or the project doesn't have // such an extension, assume it is a plain old C header. @@ -691,8 +701,10 @@ namespace build2 // Find or insert target. // + // @@ OPT: move d, out, n + // path_target& pt ( - static_cast (search (*tt, d, n, e, &ds))); + static_cast (search (*tt, d, out, n, e, &ds))); // Assign path. // -- cgit v1.1