aboutsummaryrefslogtreecommitdiff
path: root/build/config
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-08 11:55:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-08 11:55:39 +0200
commitc2902796f7c1d2a3d4d9d4c6190d376d441e0041 (patch)
treea0874a65ef3045e1691ba4c39999e136371d3762 /build/config
parentf7479697d7dcb8c2fa780c263979ef25133dfc9b (diff)
Configure subprojects that were loaded
Diffstat (limited to 'build/config')
-rw-r--r--build/config/operation.cxx83
1 files changed, 54 insertions, 29 deletions
diff --git a/build/config/operation.cxx b/build/config/operation.cxx
index 6f5beba..f223028 100644
--- a/build/config/operation.cxx
+++ b/build/config/operation.cxx
@@ -127,52 +127,77 @@ namespace build
}
static void
- configure_execute (action a, const action_targets& ts)
+ configure_project (action a, scope& root)
{
- tracer trace ("configure_execute");
+ tracer trace ("configure_project");
- for (void* v: ts)
- {
- target& t (*static_cast<target*> (v));
- scope* rs (t.root_scope ());
+ const path& out_root (root.path ());
+ const path& src_root (root.src_path ());
- if (rs == nullptr)
- fail << "out of project target " << t;
+ // Make sure the directories exist.
+ //
+ if (out_root != src_root)
+ {
+ mkdir (out_root);
+ mkdir (out_root / build_dir);
+ mkdir (out_root / bootstrap_dir);
+ }
- const path& out_root (rs->path ());
- const path& src_root (rs->src_path ());
+ // We distinguish between a complete configure and operation-
+ // specific.
+ //
+ if (a.operation () == default_id)
+ {
+ level4 ([&]{trace << "completely configuring " << out_root;});
- // Make sure the directories exist.
+ // Save src-root.build unless out_root is the same as src.
//
if (out_root != src_root)
- {
- mkdir (out_root);
- mkdir (out_root / build_dir);
- mkdir (out_root / bootstrap_dir);
- }
+ save_src_root (out_root, src_root);
- // We distinguish between a complete configure and operation-
- // specific.
+ // Save config.build.
//
- if (a.operation () == default_id)
+ save_config (root);
+ }
+ else
+ {
+ }
+
+ // Configure subprojects that have been loaded.
+ //
+ if (auto v = root.ro_variables ()["subprojects"])
+ {
+ for (const name& n: v.as<const list_value&> ().data)
{
- level4 ([&]{trace << "completely configuring " << out_root;});
+ path out_nroot (out_root / n.dir);
+ scope& nroot (scopes.find (out_nroot));
- // Save src-root.build unless out_root is the same as src.
+ // @@ Strictly speaking we need to check whether the config
+ // module was loaded for this subproject.
//
- if (out_root != src_root)
- save_src_root (out_root, src_root);
+ if (nroot.path () != out_nroot) // This subproject was not loaded.
+ continue;
- // Save config.build.
- //
- save_config (*rs);
- }
- else
- {
+ configure_project (a, nroot);
}
}
}
+ static void
+ configure_execute (action a, const action_targets& ts)
+ {
+ for (void* v: ts)
+ {
+ target& t (*static_cast<target*> (v));
+ scope* rs (t.root_scope ());
+
+ if (rs == nullptr)
+ fail << "out of project target " << t;
+
+ configure_project (a, *rs);
+ }
+ }
+
meta_operation_info configure {
"configure",
"configure",