From 6accb227b75fef7e99257b0078eb95f9aa0823cc Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 2 Feb 2026 18:30:58 +0100 Subject: New syntax --- src/ctor.h | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 3 deletions(-) (limited to 'src/ctor.h') diff --git a/src/ctor.h b/src/ctor.h index 29c8f6d..aa46e5f 100644 --- a/src/ctor.h +++ b/src/ctor.h @@ -297,8 +297,90 @@ using GeneratorManyToOne = const ctor::build_configuration& config, const ctor::settings& settings)>; +struct name +{ + std::string name; +}; + +struct target +{ + std::string target; +}; + +using sources = std::vector; + +struct depends +{ + std::vector depends; +}; + +struct externals +{ + std::vector externals; +}; + struct build_configuration { + template + requires (( + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v + ) && ...) + constexpr build_configuration(Args && ... arg) + { + ([&] + { + if constexpr(std::is_same_v) + { + name = arg.name; + } + else if constexpr(std::is_same_v) + { + type = arg; + } + else if constexpr(std::is_same_v) + { + system = arg; + } + else if constexpr(std::is_same_v) + { + target = arg.target; + } + else if constexpr(std::is_same_v) + { + sources = arg; + } + else if constexpr(std::is_same_v) + { + depends = arg.depends; + } + else if constexpr(std::is_same_v) + { + flags = arg; + } + else if constexpr(std::is_same_v) + { + externals = arg.externals; + } + else if constexpr(std::is_same_v) + { + function_one_to_one = arg; + } + else if constexpr(std::is_same_v) + { + function_many_to_one = arg; + } + }(), ...); + } + std::string name; // Name - used for referring in other configurations. ctor::target_type type{ctor::target_type::automatic}; ctor::output_system system{ctor::output_system::build}; @@ -307,9 +389,8 @@ struct build_configuration std::vector depends; // internal target dependencies ctor::flags flags; std::vector externals; // externals used by this configuration - std::variant function; + ctor::GeneratorOneToOne function_one_to_one; + ctor::GeneratorManyToOne function_many_to_one; }; using build_configurations = std::vector; -- cgit v1.2.3