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/config/module | 19 +++++++++++++++++++ build/config/module.cxx | 43 +++++++++++++++++++++++++++++++++++++++++++ build/config/operation | 17 +++++++++++++++++ build/config/operation.cxx | 14 ++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 build/config/module create mode 100644 build/config/module.cxx create mode 100644 build/config/operation create mode 100644 build/config/operation.cxx (limited to 'build/config') diff --git a/build/config/module b/build/config/module new file mode 100644 index 0000000..5a9d362 --- /dev/null +++ b/build/config/module @@ -0,0 +1,19 @@ +// file : build/config/module -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef BUILD_CONFIG_MODULE +#define BUILD_CONFIG_MODULE + +#include + +namespace build +{ + namespace config + { + void + load (scope&, scope&, const location&); + } +} + +#endif // BUILD_CONFIG_MODULE diff --git a/build/config/module.cxx b/build/config/module.cxx new file mode 100644 index 0000000..bbaccdc --- /dev/null +++ b/build/config/module.cxx @@ -0,0 +1,43 @@ +// file : build/config/module.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include + +#include +#include +#include + +using namespace std; + +namespace build +{ + namespace config + { + static bool + trigger (scope&, const path& p) + { + tracer trace ("config::trigger"); + + level4 ([&]{trace << "intercepted sourcing of " << p;}); + return false; + } + + void + load (scope& root, scope& base, const location& l) + { + tracer trace ("config::load"); + + if (&root != &base) + fail (l) << "config module must be loaded in project root scope"; + + //@@ TODO: avoid multiple loads (generally, for modules). + // + level4 ([&]{trace << "for " << root.path () << '/';}); + + // Register the build/config.build loading trigger. + // + root.triggers[path ("build/config.build")] = &trigger; + } + } +} diff --git a/build/config/operation b/build/config/operation new file mode 100644 index 0000000..a233e63 --- /dev/null +++ b/build/config/operation @@ -0,0 +1,17 @@ +// file : build/config/operation -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef BUILD_CONFIG_OPERATION +#define BUILD_CONFIG_OPERATION + +#include + +namespace build +{ + namespace config + { + } +} + +#endif // BUILD_CONFIG_OPERATION diff --git a/build/config/operation.cxx b/build/config/operation.cxx new file mode 100644 index 0000000..cc04929 --- /dev/null +++ b/build/config/operation.cxx @@ -0,0 +1,14 @@ +// file : build/config/operation.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include + +using namespace std; + +namespace build +{ + namespace config + { + } +} -- cgit v1.1