aboutsummaryrefslogtreecommitdiff
path: root/build/config
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-02 11:37:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-02 11:37:15 +0200
commit9891b20350021ce41a950645dd76df20a45c92cc (patch)
tree0cd27041b0c3413e17b9319ae99e87c5e745b1ff /build/config
parent74212589a797ca75e55f92a522e198915c0dbaf6 (diff)
Implement optional module loading
The syntax is: using? cli Now each module use results in two bool variables: <module>.loaded and <module>.configured. Also implement variable visibility (the above two variables are limited to project).
Diffstat (limited to 'build/config')
-rw-r--r--build/config/module6
-rw-r--r--build/config/module.cxx9
-rw-r--r--build/config/utility7
3 files changed, 13 insertions, 9 deletions
diff --git a/build/config/module b/build/config/module
index 58d9814..530fa7b 100644
--- a/build/config/module
+++ b/build/config/module
@@ -6,15 +6,17 @@
#define BUILD_CONFIG_MODULE
#include <build/types>
+#include <build/utility>
+
#include <build/module>
namespace build
{
namespace config
{
- extern "C" void
+ extern "C" bool
config_init (
- scope&, scope&, const location&, std::unique_ptr<module>&, bool);
+ scope&, scope&, const location&, unique_ptr<module>&, bool, bool);
}
}
diff --git a/build/config/module.cxx b/build/config/module.cxx
index bb787a0..b95c6c7 100644
--- a/build/config/module.cxx
+++ b/build/config/module.cxx
@@ -24,12 +24,13 @@ namespace build
//
static const path config_file ("build/config.build");
- extern "C" void
+ extern "C" bool
config_init (scope& r,
scope& b,
const location& l,
std::unique_ptr<module>&,
- bool first)
+ bool first,
+ bool)
{
tracer trace ("config::init");
@@ -39,7 +40,7 @@ namespace build
if (!first)
{
warn (l) << "multiple config module initializations";
- return;
+ return true;
}
const dir_path& out_root (r.out_path ());
@@ -65,6 +66,8 @@ namespace build
if (file_exists (f))
source (f, r, r);
+
+ return true;
}
}
}
diff --git a/build/config/utility b/build/config/utility
index 9a5dc5e..ece7a88 100644
--- a/build/config/utility
+++ b/build/config/utility
@@ -42,8 +42,7 @@ namespace build
const T& default_value,
bool override = false)
{
- return required (
- root, variable_pool.find (name), default_value, override);
+ return required (root, var_pool.find (name), default_value, override);
}
inline std::pair<std::reference_wrapper<const value>, bool>
@@ -68,7 +67,7 @@ namespace build
inline const value&
optional (scope& root, const std::string& var)
{
- return optional (root, variable_pool.find (var));
+ return optional (root, var_pool.find (var));
}
// As above but assumes the value is dir_path and makes it
@@ -81,7 +80,7 @@ namespace build
inline const value&
optional_absolute (scope& root, const std::string& var)
{
- return optional_absolute (root, variable_pool.find (var));
+ return optional_absolute (root, var_pool.find (var));
}
// Check whether there are any variables specified from the