summaryrefslogtreecommitdiff
path: root/src/task.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/task.cc')
-rw-r--r--src/task.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/task.cc b/src/task.cc
index b8fce06..3ec48f5 100644
--- a/src/task.cc
+++ b/src/task.cc
@@ -6,9 +6,14 @@
#include <unistd.h>
#include <iostream>
-Task::Task(const BuildConfiguration& config)
+#include "settings.h"
+
+Task::Task(const BuildConfiguration& config, const Settings& settings,
+ const std::string& sourceDir)
: config(config)
, output_system(config.system)
+ , settings(settings)
+ , sourceDir(sourceDir)
{
}
@@ -19,7 +24,7 @@ int Task::registerDepTasks(const std::set<std::shared_ptr<Task>>& tasks)
bool found{false};
for(const auto& task : tasks)
{
- if(task->target() == depStr)
+ if(*task == depStr)
{
dependsTasks.insert(task);
found = true;
@@ -36,13 +41,18 @@ int Task::registerDepTasks(const std::set<std::shared_ptr<Task>>& tasks)
return 0;
}
+bool Task::operator==(const std::string& depStr)
+{
+ return
+ name() == depStr ||
+ target() == depStr ||
+ sourceDir + "/" + target() == depStr ||
+ targetFile().string() == depStr
+ ;
+}
+
std::string Task::name() const
{
- // If config name is not set, use target instead.
- if(config.name.empty())
- {
- return config.target;
- }
return config.name;
}