From b6e72877a1a26a6ae16961728ee57e45f657f717 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 18 Mar 2015 15:45:56 +0200 Subject: Implement complete root/base detection, basic module support This is the initial groundwork for the configuration support. --- build/scope | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'build/scope') diff --git a/build/scope b/build/scope index e5c5fec..f86d0ed 100644 --- a/build/scope +++ b/build/scope @@ -5,7 +5,9 @@ #ifndef BUILD_SCOPE #define BUILD_SCOPE +#include // function #include +#include #include #include @@ -57,6 +59,19 @@ namespace build // std::unordered_set buildfiles; + + // A map of buildfiles to trigger functions that are executed when + // such files are sourced. The path is is assumed to be relative to + // the src directory corresponding to this scope. + // + // The passed path is the actual, absolute buildfile path. If the + // returned value is true, then the file is sourced. If false -- + // the file is ignored. Note that currently triggers can only be + // registered on the project root scope. + // + using trigger_type = std::function; + std::unordered_map triggers; + private: iterator i_; scope* parent_; @@ -68,9 +83,11 @@ namespace build // Note that we assume the first insertion into the map is that // of the root scope. // + std::pair + insert (const path&); scope& - operator[] (const path&); + operator[] (const path& p) {return insert (p).first;} // Find the most qualified scope that encompasses this path. // -- cgit v1.1