From ba04d2889a4e017c6043bac9951f722e60b63bc5 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 14 Sep 2021 07:46:43 +0200 Subject: Add suport for building and running unittests with the 'check' target. --- src/tasks.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/tasks.cc') diff --git a/src/tasks.cc b/src/tasks.cc index 1607b37..3113564 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -3,6 +3,7 @@ #include #include #include +#include #include "settings.h" #include "libctor.h" @@ -101,6 +102,7 @@ std::list> taskFactory(const BuildConfiguration& config, break; case TargetType::Executable: + case TargetType::UnitTest: tasks.emplace_back(std::make_shared(config, settings, config.target, objects)); break; @@ -111,6 +113,7 @@ std::list> taskFactory(const BuildConfiguration& config, return tasks; } +} std::shared_ptr getNextTask(const std::list>& allTasks, std::list>& dirtyTasks) @@ -131,15 +134,20 @@ std::shared_ptr getNextTask(const std::list>& allTas return nullptr; } -std::list> getTasks(const Settings& settings) +std::list> getTasks(const Settings& settings, + const std::vector names) { auto& targets = getTargets(settings); std::list> tasks; for(const auto& target : targets) { - std::vector objects; - auto t = taskFactory(target.config, settings, target.path); - tasks.insert(tasks.end(), t.begin(), t.end()); + if(names.empty() || + std::find(std::begin(names), std::end(names), target.config.target) != std::end(names)) + { + std::vector objects; + auto t = taskFactory(target.config, settings, target.path); + tasks.insert(tasks.end(), t.begin(), t.end()); + } } return tasks; -- cgit v1.2.3