summaryrefslogtreecommitdiffhomepage
path: root/xmake.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-02-11 15:47:10 +0100
committerRoland Reichwein <mail@reichwein.it>2023-02-11 15:47:10 +0100
commit44388020aa696238daff956fd06d8470c3e9dcf2 (patch)
treee5b61483f8ea356a96f543666d2f9deb7360aa9f /xmake.cpp
Added debian infrastructure
Diffstat (limited to 'xmake.cpp')
-rw-r--r--xmake.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/xmake.cpp b/xmake.cpp
new file mode 100644
index 0000000..9d953cc
--- /dev/null
+++ b/xmake.cpp
@@ -0,0 +1,65 @@
+#include "xmake.h"
+
+#include <filesystem>
+#include <iostream>
+#include <sstream>
+#include <string>
+
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+#include <boost/process.hpp>
+
+namespace fs = std::filesystem;
+namespace bp = boost::process;
+namespace pt = boost::property_tree;
+using namespace std::string_literals;
+
+namespace {
+ const fs::path XMakefile{"XMakefile"};
+
+ void usage()
+ {
+ std::cout << "Usage: xmake <target>" << std::endl;
+ }
+}
+
+int xmake(int argc, char* argv[])
+{
+ try {
+ pt::ptree ptree;
+ pt::read_xml(XMakefile, ptree, pt::xml_parser::no_comments | pt::xml_parser::trim_whitespace);
+
+ std::string action{"default"};
+
+ if (argc == 1) { // default action
+ } else if (argc == 2) {
+ action = argv[1];
+ } else {
+ std::cerr << "Invalid arguments." << std::endl;
+ usage;
+ exit(1);
+ }
+
+ if (action == "default"s || action == "build") { // build
+ } else if (action == "clean") {
+ } else if (action == "install") {
+ } else if (action == "rebuild") {
+ } else if (action == "run") {
+ } else {
+ std::cerr << "Invalid action: " << action << std::endl;
+ usage;
+ exit(1);
+ }
+
+ // TODO: clearlist
+ // TODO: dependencies
+ // TODO: buildlist
+
+ } catch (const std::exception& ex) {
+ std::cerr << "Error: " << ex.what() << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
+