From 5a3e0931e0e4ccd252c527b512ec1634d57489d8 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 23 Feb 2026 21:03:11 +0100 Subject: WIP --- src/ctor.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 6 deletions(-) (limited to 'src/ctor.h') diff --git a/src/ctor.h b/src/ctor.h index 9320c3d..665ab75 100644 --- a/src/ctor.h +++ b/src/ctor.h @@ -75,6 +75,11 @@ enum class source_type generated, }; +struct nodist +{ + bool value{true}; +}; + struct source { template @@ -83,7 +88,8 @@ struct source 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 source(Args && ... arg) { @@ -109,6 +115,10 @@ struct source { source_type = arg; } + else if constexpr(std::is_same_v) + { + nodist = arg.value; + } }(), ...); } @@ -117,6 +127,7 @@ struct source ctor::language language{ctor::language::automatic}; std::string output{}; ctor::source_type source_type{ctor::source_type::regular}; + bool nodist{false}; }; using sources = std::vector; @@ -125,7 +136,8 @@ struct header { template requires (( - std::is_convertible_v + std::is_convertible_v || + std::is_same_v ) && ...) constexpr header(Args && ... arg) { @@ -135,19 +147,47 @@ struct header { file = arg; } - else if constexpr(std::is_same_v) + else if constexpr(std::is_same_v) { - install = arg; + nodist = arg.value; } }(), ...); } std::string file; - ctor::install install; + bool nodist{false}; }; using headers = std::vector; +struct extra_dist_file +{ + template + requires (( + std::is_convertible_v || + std::is_same_v + ) && ...) + constexpr extra_dist_file(Args && ... arg) + { + ([&] + { + if constexpr(std::is_convertible_v) + { + file = arg; + } + else if constexpr(std::is_same_v) + { + nodist = arg.value; + } + }(), ...); + } + + std::string file; + bool nodist{false}; +}; + +using extra_dist = std::vector; + enum class cxx_opt { // gcc/clang @@ -381,16 +421,32 @@ struct externals std::vector externals; }; +struct version +{ + int major; + int minor; + int patch; + std::string tweak{}; +}; + +struct project +{ + std::string name; + ctor::version version; +}; + 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 || std::is_convertible_v || @@ -405,7 +461,11 @@ struct build_configuration { ([&] { - if constexpr(std::is_same_v) + if constexpr(std::is_same_v) + { + project = arg; + } + else if constexpr(std::is_same_v) { name = arg.name; } @@ -429,6 +489,10 @@ struct build_configuration { headers = arg; } + else if constexpr(std::is_same_v) + { + extra_dist = arg; + } else if constexpr(std::is_same_v) { depends = arg.depends; @@ -468,12 +532,14 @@ struct build_configuration }(), ...); } + ctor::project project{}; 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}; std::string target; // Output target file for this configuration ctor::sources sources; // source list ctor::headers headers; // header list + ctor::extra_dist extra_dist; // extra files to be added to dist std::vector depends; // internal target dependencies ctor::flags flags; std::vector externals; // externals used by this configuration -- cgit v1.2.3