summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile23
-rw-r--r--XMakefile7
-rw-r--r--debian/README.Debian19
-rw-r--r--debian/changelog5
-rw-r--r--debian/compat1
-rw-r--r--debian/control14
-rw-r--r--debian/copyright4
-rwxr-xr-xdebian/rules4
-rw-r--r--debian/source/format1
-rw-r--r--main.cpp7
-rw-r--r--xmake.cpp65
-rw-r--r--xmake.h4
12 files changed, 154 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..92fc9a8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,23 @@
+PROJECTNAME=xmake
+
+SRC=main.cpp xmake.cpp
+
+OBJ=$(SRC:.cpp=.o)
+
+all: $(PROJECTNAME)
+
+$(PROJECTNAME): $(OBJ)
+ $(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@
+
+%.o: %.cpp
+ $(CXX) $(CXXFLAGS) -c $< -o $@
+
+install:
+ mkdir -p $(DESTDIR)/usr/bin
+ cp $(PROJECTNAME) $(DESTDIR)/usr/bin/
+
+clean:
+ -rm -f *.o $(PROJECTNAME)
+
+.PHONY: clean install all
+
diff --git a/XMakefile b/XMakefile
new file mode 100644
index 0000000..ac3a34e
--- /dev/null
+++ b/XMakefile
@@ -0,0 +1,7 @@
+<xmake>
+ <build>
+ <name>xmake</name>
+ <source>xmake.cpp</source>
+ <source>main.cpp</source>
+ </build>
+</xmake>
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..4da4a5b
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,19 @@
+xmake for Debian
+================
+
+This package is the Debian version of xmake.
+
+It is a build system with XML based config files.
+
+
+Usage
+-----
+
+Run "xmake" like "make" to build programs with an XMakefile.
+
+
+Contact
+-------
+
+Reichwein IT <mail@reichwein.it>
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..d94dedf
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+xmake (1.0) unstable; urgency=medium
+
+ * Initial release
+
+ -- Roland Reichwein <mail@reichwein.it> Sat, 05 Nov 2022 13:34:57 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..48082f7
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+12
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..c27819e
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,14 @@
+Source: xmake
+Section: devel
+Priority: optional
+Maintainer: Roland Reichwein <mail@reichwein.it>
+Build-Depends: debhelper (>= 12), libboost-all-dev | libboost1.71-all-dev, clang | g++-9, llvm | g++-9, lld | g++-9, pkg-config, libfmt-dev, googletest, gcovr, libreichwein-dev
+Standards-Version: 4.5.0
+Homepage: http://www.reichwein.it/xmake/
+
+Package: xmake
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Homepage: http://www.reichwein.it/xmake/
+Description: Buildsystem
+ XMake is a buildsystem with automatically resolved dependencies.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..a50fc15
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,4 @@
+Author: Roland Reichwein <mail@reichwein.it>, 2023
+
+Both upstream source code and Debian packaging is available
+under the conditions of CC0 1.0 Universal
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..2d33f6a
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..964a3bb
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,7 @@
+#include "xmake.h"
+
+int main(int argc, char* argv[])
+{
+ return xmake(argc, argv);
+}
+
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;
+}
+
diff --git a/xmake.h b/xmake.h
new file mode 100644
index 0000000..6c402cf
--- /dev/null
+++ b/xmake.h
@@ -0,0 +1,4 @@
+#pragma once
+
+int xmake(int argc, char* argv[]);
+