From 9891b20350021ce41a950645dd76df20a45c92cc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 2 Dec 2015 11:37:15 +0200 Subject: Implement optional module loading The syntax is: using? cli Now each module use results in two bool variables: .loaded and .configured. Also implement variable visibility (the above two variables are limited to project). --- build/install/module | 6 ++++-- build/install/module.cxx | 17 ++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'build/install') diff --git a/build/install/module b/build/install/module index 240d034..78004ef 100644 --- a/build/install/module +++ b/build/install/module @@ -6,15 +6,17 @@ #define BUILD_INSTALL_MODULE #include +#include + #include namespace build { namespace install { - extern "C" void + extern "C" bool install_init ( - scope&, scope&, const location&, std::unique_ptr&, bool); + scope&, scope&, const location&, unique_ptr&, bool, bool); } } diff --git a/build/install/module.cxx b/build/install/module.cxx index a0eed61..8711341 100644 --- a/build/install/module.cxx +++ b/build/install/module.cxx @@ -51,7 +51,7 @@ namespace build vn += name; vn += var; const variable& vr ( - variable_pool.find (move (vn), &value_traits::value_type)); + var_pool.find (move (vn), &value_traits::value_type)); cv = dv != nullptr ? &config::required (r, vr, *dv, override).first.get () @@ -62,7 +62,7 @@ namespace build vn += name; vn += var; const variable& vr ( - variable_pool.find (move (vn), &value_traits::value_type)); + var_pool.find (move (vn), &value_traits::value_type)); value& v (r.assign (vr)); @@ -99,12 +99,13 @@ namespace build static alias_rule alias_; static file_rule file_; - extern "C" void + extern "C" bool install_init (scope& r, scope& b, const location& l, - unique_ptr&, - bool first) + unique_ptr&, + bool first, + bool) { tracer trace ("install::init"); @@ -114,7 +115,7 @@ namespace build if (!first) { warn (l) << "multiple install module initializations"; - return; + return true; } const dir_path& out_root (r.out_path ()); @@ -135,7 +136,7 @@ namespace build // if (first) { - variable_pool.find ("install", dir_path_type); + var_pool.find ("install", dir_path_type); } // Configuration. @@ -172,6 +173,8 @@ namespace build path (b, dir_path ("doc")); // Install into install.doc. path (b, dir_path ("man")); // Install into install.man. path (b, dir_path ("man1")); // Install into install.man1. + + return true; } } } -- cgit v1.1