summaryrefslogtreecommitdiff
path: root/src/task.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/task.cc')
-rw-r--r--src/task.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/task.cc b/src/task.cc
index 7813235..cd03fce 100644
--- a/src/task.cc
+++ b/src/task.cc
@@ -3,16 +3,16 @@
// 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_))
{
}
@@ -45,10 +45,12 @@ 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 ||
+ generated_output == depStr ||
targetFile().string() == depStr
;
}
@@ -144,6 +146,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 +155,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()