aboutsummaryrefslogtreecommitdiff
path: root/build2/dist/operation.cxx
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/dist/operation.cxx
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/dist/operation.cxx')
-rw-r--r--build2/dist/operation.cxx41
1 files changed, 24 insertions, 17 deletions
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx
index 9ae5773..aea957a 100644
--- a/build2/dist/operation.cxx
+++ b/build2/dist/operation.cxx
@@ -139,21 +139,30 @@ namespace build2
// ignored on the next step if the user explicitly marked them
// nodist.
//
- auto add_adhoc = [&src_root, &trace] (const dir_path& d, const char* f)
+ auto add_adhoc = [&trace] (scope& rs, const char* f)
+ {
+ path p (rs.src_path () / path (f));
+ if (file_exists (p))
{
- path p (d / path (f));
- if (file_exists (p))
- {
- const char* e (p.extension ());
- targets.insert<buildfile> (
- p.directory (),
- p.leaf ().base ().string (),
- &extension_pool.find (e == nullptr ? "" : e), // Specified.
- trace);
- }
- };
+ dir_path d (p.directory ());
- add_adhoc (src_root, "build/export.build");
+ // Figure out if we need out.
+ //
+ dir_path out (rs.src_path () != rs.out_path ()
+ ? out_src (d, rs)
+ : dir_path ());
+
+ const char* e (p.extension ());
+ targets.insert<buildfile> (
+ move (d),
+ move (out),
+ p.leaf ().base ().string (),
+ &extension_pool.find (e == nullptr ? "" : e), // Specified.
+ trace);
+ }
+ };
+
+ add_adhoc (*rs, "build/export.build");
// The same for subprojects that have been loaded.
//
@@ -168,12 +177,10 @@ namespace build2
if (nrs.out_path () != out_nroot) // This subproject not loaded.
continue;
- const dir_path& src_nroot (nrs.src_path ());
-
- if (!src_nroot.sub (src_root)) // Not a strong amalgamation.
+ if (!nrs.src_path ().sub (src_root)) // Not a strong amalgamation.
continue;
- add_adhoc (src_nroot, "build/export.build");
+ add_adhoc (nrs, "build/export.build");
}
}