aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/scope.ixx')
-rw-r--r--libbuild2/scope.ixx37
1 files changed, 37 insertions, 0 deletions
diff --git a/libbuild2/scope.ixx b/libbuild2/scope.ixx
index 3498ae0..aa1247f 100644
--- a/libbuild2/scope.ixx
+++ b/libbuild2/scope.ixx
@@ -51,4 +51,41 @@ namespace build2
return false;
}
+
+ inline dir_path
+ src_out (const dir_path& out, const scope& r)
+ {
+ assert (r.root ());
+ return src_out (out, r.out_path (), r.src_path ());
+ }
+
+ inline dir_path
+ out_src (const dir_path& src, const scope& r)
+ {
+ assert (r.root ());
+ return out_src (src, r.out_path (), r.src_path ());
+ }
+
+ inline dir_path
+ src_out (const dir_path& o,
+ const dir_path& out_root, const dir_path& src_root)
+ {
+ assert (o.sub (out_root));
+ return src_root / o.leaf (out_root);
+ }
+
+ inline dir_path
+ out_src (const dir_path& s,
+ const dir_path& out_root, const dir_path& src_root)
+ {
+ assert (s.sub (src_root));
+ return out_root / s.leaf (src_root);
+ }
+
+ inline const project_name&
+ project (const scope& root)
+ {
+ auto l (root[var_project]);
+ return l ? cast<project_name> (l) : empty_project_name;
+ }
}