aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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",