diff options
author | Roland Reichwein <mail@reichwein.it> | 2024-05-03 21:03:06 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2024-05-03 21:03:06 +0200 |
commit | 45983abe664be648b513202c8c12578c9a85784f (patch) | |
tree | 37166e1f24219b84aab1c9e79d7743c8f59e9022 /Builder.h | |
parent | 6669794434cb9f472aafce126162b9b81389df5f (diff) |
Parallel build
Diffstat (limited to 'Builder.h')
-rw-r--r-- | Builder.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Builder.h b/Builder.h new file mode 100644 index 0000000..12338f0 --- /dev/null +++ b/Builder.h @@ -0,0 +1,40 @@ +#pragma once + +#include <filesystem> +#include <unordered_map> +#include <unordered_set> +#include <vector> + +#include <boost/property_tree/ptree.hpp> + +#include "ProcessRunner.h" + +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_file(const std::filesystem::path& p); + void build_list(); + + void cleanup(); + + 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; + + ProcessRunner _runner; + + std::unordered_set<std::filesystem::path> _buildlist; // build done + std::unordered_set<std::filesystem::path> _activelist; // currently building + std::unordered_set<std::filesystem::path> _donelist; // build done +}; + |