diff options
Diffstat (limited to 'src/task.cc')
| -rw-r--r-- | src/task.cc | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/task.cc b/src/task.cc index 7813235..77c745e 100644 --- a/src/task.cc +++ b/src/task.cc @@ -3,22 +3,27 @@ // See accompanying file LICENSE for details. #include "task.h" -#include <unistd.h> #include <iostream> #include <algorithm> +#include <utility> -Task::Task(const ctor::build_configuration& config, const ctor::settings& settings, - const std::string& sourceDir) - : config(config) +Task::Task(const ctor::build_configuration& config_, const ctor::settings& settings_, + std::string sourceDir_) + : config(config_) , output_system(config.system) - , settings(settings) - , sourceDir(sourceDir) + , settings(settings_) + , sourceDir(std::move(sourceDir_)) { } int Task::registerDepTasks(const std::vector<std::shared_ptr<Task>>& tasks) { - for(const auto& depStr : depends()) + auto dependsList = depends(); + for(const auto& dep : config.depends) + { + dependsList.emplace_back(dep); + } + for(const auto& depStr : dependsList) { bool found{false}; for(const auto& task : tasks) @@ -45,11 +50,14 @@ int Task::registerDepTasks(const std::vector<std::shared_ptr<Task>>& tasks) bool Task::operator==(const std::string& depStr) { + std::filesystem::path generated_output = sourceDir; + generated_output /= target(); return - name() == depStr || - target() == depStr || - sourceDir + "/" + target() == depStr || - targetFile().string() == depStr + (!derived() && name() == depStr) || // compare to name + (!derived() && config.target == depStr) || // compare to stated target (ex. foo.a) + target() == depStr || // compare to derived (derived to foo.lib on msvc) + generated_output == depStr || // not sure what this is for?! + targetFile().string() == depStr // compare to target output file ; } @@ -144,6 +152,7 @@ std::string Task::compiler() const case ctor::output_system::build: return c.get(ctor::cfg::build_cc, "/usr/bin/gcc"); } + break; case ctor::language::cpp: switch(outputSystem()) { @@ -152,11 +161,15 @@ std::string Task::compiler() const case ctor::output_system::build: return c.get(ctor::cfg::build_cxx, "/usr/bin/g++"); } + break; default: std::cerr << "Unknown CC target type\n"; exit(1); break; } + + std::cerr << "Unhandled compiler!\n"; + exit(1); } std::vector<std::shared_ptr<Task>> Task::getDependsTasks() |
