aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-01-31 11:19:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-01-31 11:19:21 +0200
commitaca4d044103d6a67c5aaa9cabf2be1155199ccc5 (patch)
tree021fb64b782f8a3017b9accd1dd3c1b523e01c18
parent76678d4186603fda18c929b0f09ca4ea312b72de (diff)
Add initial build system driver initialization
-rw-r--r--bpkg/bpkg.cxx33
-rw-r--r--bpkg/buildfile2
2 files changed, 35 insertions, 0 deletions
diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx
index a4946fe..c1a4908 100644
--- a/bpkg/bpkg.cxx
+++ b/bpkg/bpkg.cxx
@@ -12,6 +12,19 @@
#include <libbutl/backtrace.hxx> // backtrace()
+// Embedded build system driver.
+//
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/in/init.hxx>
+#include <libbuild2/bin/init.hxx>
+#include <libbuild2/c/init.hxx>
+#include <libbuild2/cc/init.hxx>
+#include <libbuild2/cxx/init.hxx>
+#include <libbuild2/bash/init.hxx>
+#include <libbuild2/version/init.hxx>
+
#include <bpkg/types.hxx>
#include <bpkg/utility.hxx>
@@ -371,6 +384,26 @@ init (const common_options& co,
if (tmp)
init_tmp (dir_path (cfg_dir (&o)));
+ // Build system driver.
+ //
+ // @@ TODO: perhaps we should only do it for commands that need it?
+ //
+ {
+ using namespace build2;
+
+ // @@ TMP: pass proper values instead of dummies.
+ //
+ init_diag (1);
+ init (nullptr, "bpkg" /*argv[0]*/);
+
+ bin::build2_bin_load ();
+ cc::build2_cc_load ();
+ c::build2_c_load ();
+ cxx::build2_cxx_load ();
+ version::build2_version_load ();
+ in::build2_in_load ();
+ }
+
return o;
}
diff --git a/bpkg/buildfile b/bpkg/buildfile
index 93f8712..cc9e7b5 100644
--- a/bpkg/buildfile
+++ b/bpkg/buildfile
@@ -10,6 +10,8 @@ xml{*}: extension = xml
import libs = build2%lib{build2}
+# NOTE: see also module loading in bpkg.cxx if adding anything here.
+#
for m: bin c cc cxx in version
import libs += build2%lib{build2-$m}