From 1af138308d01f96dd979f0137394dcbd5971d5e1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 10 Feb 2026 19:38:36 +0100 Subject: WIP: install --- src/ctor.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'src/ctor.h') diff --git a/src/ctor.h b/src/ctor.h index 665ab75..9c00225 100644 --- a/src/ctor.h +++ b/src/ctor.h @@ -80,6 +80,48 @@ struct nodist bool value{true}; }; +enum class install_type +{ + automatic, // Deduced from target-type + program, + library, + header, + // man, ... +}; + +/// Indicate that this target should be part of install target +struct install +{ + template + requires (( + std::is_same_v || + std::is_same_v || + std::is_convertible_v + ) && ...) + constexpr install(Args && ... arg) + { + do_install = true; + ([&] + { + if constexpr(std::is_same_v) + { + do_install = arg; + } + else if constexpr(std::is_same_v) + { + type = arg; + } + else if constexpr(std::is_convertible_v) + { + path = arg; + } + }(), ...); + } + ctor::install_type type{ctor::install_type::automatic}; + std::string path; // Default: Install dir for type (bin, lib, include, ...) + bool do_install{false}; +}; + struct source { template @@ -137,7 +179,8 @@ struct header template requires (( std::is_convertible_v || - std::is_same_v + std::is_same_v || + std::is_same_v ) && ...) constexpr header(Args && ... arg) { @@ -156,6 +199,7 @@ struct header std::string file; bool nodist{false}; + ctor::install install{false}; }; using headers = std::vector; @@ -448,6 +492,7 @@ struct build_configuration std::is_same_v || std::is_same_v || std::is_same_v || + std::is_same_v || std::is_same_v || std::is_convertible_v || std::is_convertible_v || @@ -497,6 +542,10 @@ struct build_configuration { depends = arg.depends; } + else if constexpr(std::is_same_v) + { + install = arg; + } else if constexpr(std::is_same_v) { externals = arg.externals; @@ -545,6 +594,7 @@ struct build_configuration std::vector externals; // externals used by this configuration ctor::GeneratorOneToOne function_one_to_one; ctor::GeneratorManyToOne function_many_to_one; + ctor::install install{false}; }; using build_configurations = std::vector; -- cgit v1.2.3