aboutsummaryrefslogtreecommitdiff
path: root/build/config/module.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-03-18 15:45:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-03-18 15:45:56 +0200
commitb6e72877a1a26a6ae16961728ee57e45f657f717 (patch)
treea161dd0d5ded669100a4adda9db256a30c366a9b /build/config/module.cxx
parent5b5aabc6d347ff209c35b2db7250d4caaf9fd643 (diff)
Implement complete root/base detection, basic module support
This is the initial groundwork for the configuration support.
Diffstat (limited to 'build/config/module.cxx')
-rw-r--r--build/config/module.cxx43
1 files changed, 43 insertions, 0 deletions
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 <build/config/module>
+
+#include <build/path>
+#include <build/scope>
+#include <build/diagnostics>
+
+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;
+ }
+ }
+}