aboutsummaryrefslogtreecommitdiff
path: root/build/module.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/module.cxx')
-rw-r--r--build/module.cxx37
1 files changed, 28 insertions, 9 deletions
diff --git a/build/module.cxx b/build/module.cxx
index 0f2b1b2..5f1aeff 100644
--- a/build/module.cxx
+++ b/build/module.cxx
@@ -7,6 +7,7 @@
#include <utility> // make_pair()
#include <build/scope>
+#include <build/variable>
#include <build/diagnostics>
using namespace std;
@@ -15,13 +16,16 @@ namespace build
{
available_module_map builtin_modules;
- void
- load_module (const string& name, scope& root, scope& base, const location& l)
+ bool
+ load_module (bool opt,
+ const string& name,
+ scope& rs,
+ scope& bs,
+ const location& loc)
{
- // First see if this modules has already been loaded for this
- // project.
+ // First see if this modules has already been loaded for this project.
//
- loaded_module_map& lm (root.modules);
+ loaded_module_map& lm (rs.modules);
auto i (lm.find (name));
bool f (i == lm.end ());
@@ -32,11 +36,26 @@ namespace build
auto j (builtin_modules.find (name));
if (j == builtin_modules.end ())
- fail (l) << "unknown module " << name;
-
- i = lm.emplace (name, make_pair (j->second, nullptr)).first;
+ {
+ if (!opt)
+ fail (loc) << "unknown module " << name;
+ }
+ else
+ i = lm.emplace (name, make_pair (j->second, nullptr)).first;
}
- i->second.first (root, base, l, i->second.second, f);
+ bool l (i != lm.end ());
+ bool c (l && i->second.first (rs, bs, loc, i->second.second, f, opt));
+
+ const variable& lv (var_pool.find (name + ".loaded",
+ variable_visibility::project,
+ bool_type));
+ const variable& cv (var_pool.find (name + ".configured",
+ variable_visibility::project,
+ bool_type));
+ bs.assign (lv) = l;
+ bs.assign (cv) = c;
+
+ return l && c;
}
}