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/bin/module | 7 +++++-- build/bin/module.cxx | 25 ++++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'build/bin') diff --git a/build/bin/module b/build/bin/module index b87a0b0..5dd720f 100644 --- a/build/bin/module +++ b/build/bin/module @@ -6,14 +6,17 @@ #define BUILD_BIN_MODULE #include +#include + #include namespace build { namespace bin { - extern "C" void - bin_init (scope&, scope&, const location&, std::unique_ptr&, bool); + extern "C" bool + bin_init ( + scope&, scope&, const location&, unique_ptr&, bool, bool); } } diff --git a/build/bin/module.cxx b/build/bin/module.cxx index 25700c6..c7da647 100644 --- a/build/bin/module.cxx +++ b/build/bin/module.cxx @@ -29,12 +29,13 @@ namespace build static const strings liba_lib {"static"}; static const strings libso_lib {"shared"}; - extern "C" void + extern "C" bool bin_init (scope& r, scope& b, const location&, std::unique_ptr&, - bool first) + bool first, + bool) { tracer trace ("bin::init"); level5 ([&]{trace << "for " << b.out_path ();}); @@ -81,15 +82,15 @@ namespace build // if (first) { - variable_pool.find ("config.bin.lib", string_type); - variable_pool.find ("config.bin.exe.lib", strings_type); - variable_pool.find ("config.bin.liba.lib", strings_type); - variable_pool.find ("config.bin.libso.lib", strings_type); - - variable_pool.find ("bin.lib", string_type); - variable_pool.find ("bin.exe.lib", strings_type); - variable_pool.find ("bin.liba.lib", strings_type); - variable_pool.find ("bin.libso.lib", strings_type); + var_pool.find ("config.bin.lib", string_type); + var_pool.find ("config.bin.exe.lib", strings_type); + var_pool.find ("config.bin.liba.lib", strings_type); + var_pool.find ("config.bin.libso.lib", strings_type); + + var_pool.find ("bin.lib", string_type); + var_pool.find ("bin.exe.lib", strings_type); + var_pool.find ("bin.liba.lib", strings_type); + var_pool.find ("bin.libso.lib", strings_type); } // Configure. @@ -164,6 +165,8 @@ namespace build install::path (b, dir_path ("lib")); // Install into install.lib. install::mode (b, "644"); + + return true; } } } -- cgit v1.1