summaryrefslogtreecommitdiffhomepage
path: root/builder.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2024-05-03 11:22:55 +0200
committerRoland Reichwein <mail@reichwein.it>2024-05-03 11:22:55 +0200
commit5ecd32cb842defe38e14dcaeb0caa2d98356a0bb (patch)
tree36d394c727b98f0d14553eaf54cb63dfc1e4dedc /builder.h
parentcb2b1059904124b8122ebe490fb504c62189d153 (diff)
Factored out Builder
Diffstat (limited to 'builder.h')
-rw-r--r--builder.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/builder.h b/builder.h
new file mode 100644
index 0000000..c139d2a
--- /dev/null
+++ b/builder.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <filesystem>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
+
+#include <boost/property_tree/ptree.hpp>
+
+class Builder
+{
+public:
+ Builder(const boost::property_tree::ptree& ptree);
+
+ void build();
+ void clean();
+
+private:
+ std::vector<std::filesystem::path> dependencies_of(const std::filesystem::path& p);
+ bool is_outdated(const std::filesystem::path& p);
+
+ void build(const std::filesystem::path& p);
+ void build(std::unordered_set<std::filesystem::path>& buildlist);
+
+ std::filesystem::path _target;
+ std::vector<std::filesystem::path> _objects;
+ std::vector<std::filesystem::path> _sources;
+ std::unordered_map<std::filesystem::path, std::vector<std::filesystem::path>> _dependencies;
+};