From fa99825fa800f0faf4a6e6b1d639b261c7aa43c9 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 27 Dec 2025 15:08:07 +0100 Subject: Add many-to-one generator function type. --- src/tasks.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/tasks.cc') diff --git a/src/tasks.cc b/src/tasks.cc index 7de8af9..fb7d72b 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -85,7 +85,7 @@ std::vector> taskFactory(const ctor::build_configuration& ctor::target_type target_type{config.type}; if(target_type == ctor::target_type::automatic) { - if(config.function != nullptr) + if(!std::holds_alternative(config.function)) { target_type = ctor::target_type::function; } @@ -114,12 +114,22 @@ std::vector> taskFactory(const ctor::build_configuration& #ifndef BOOTSTRAP else { - for(const auto& source : config.sources) + bool multi{std::holds_alternative(config.function)}; + if(multi) { - auto task = std::make_shared(config, settings, sourceDir, source); + auto task = std::make_shared(config, settings, sourceDir, ""); tasks.push_back(task); objects.push_back(task->target()); } + else + { + for(const auto& source : config.sources) + { + auto task = std::make_shared(config, settings, sourceDir, source); + tasks.push_back(task); + objects.push_back(task->target()); + } + } } #endif -- cgit v1.2.3