diff options
Diffstat (limited to 'src/ctor.h')
| -rw-r--r-- | src/ctor.h | 52 |
1 files changed, 51 insertions, 1 deletions
@@ -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 <class ... Args> + requires (( + std::is_same_v<Args, bool> || + std::is_same_v<Args, ctor::install_type> || + std::is_convertible_v<Args, std::string_view> + ) && ...) + constexpr install(Args && ... arg) + { + do_install = true; + ([&] + { + if constexpr(std::is_same_v<Args, bool>) + { + do_install = arg; + } + else if constexpr(std::is_same_v<Args, ctor::install_type>) + { + type = arg; + } + else if constexpr(std::is_convertible_v<Args, std::string_view>) + { + 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 <class ... Args> @@ -137,7 +179,8 @@ struct header template <class ... Args> requires (( std::is_convertible_v<Args, std::string_view> || - std::is_same_v<Args, ctor::nodist> + std::is_same_v<Args, ctor::nodist> || + std::is_same_v<Args, ctor::install> ) && ...) constexpr header(Args && ... arg) { @@ -156,6 +199,7 @@ struct header std::string file; bool nodist{false}; + ctor::install install{false}; }; using headers = std::vector<ctor::header>; @@ -448,6 +492,7 @@ struct build_configuration std::is_same_v<Args, ctor::headers> || std::is_same_v<Args, ctor::extra_dist> || std::is_same_v<Args, ctor::depends> || + std::is_same_v<Args, ctor::install> || std::is_same_v<Args, ctor::externals> || std::is_convertible_v<Args, ctor::GeneratorOneToOne> || std::is_convertible_v<Args, ctor::GeneratorManyToOne> || @@ -497,6 +542,10 @@ struct build_configuration { depends = arg.depends; } + else if constexpr(std::is_same_v<Args, ctor::install>) + { + install = arg; + } else if constexpr(std::is_same_v<Args, ctor::externals>) { externals = arg.externals; @@ -545,6 +594,7 @@ struct build_configuration std::vector<std::string> 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<build_configuration>; |
