summaryrefslogtreecommitdiff
path: root/src/ctor.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2026-02-23 21:03:11 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2026-02-25 17:09:10 +0100
commit5a3e0931e0e4ccd252c527b512ec1634d57489d8 (patch)
tree6df26db1090d6edfe4430fb6dd9871465b56e32a /src/ctor.h
parent2855b6e1172d5b544b150bf617b216691801f574 (diff)
WIP
Diffstat (limited to 'src/ctor.h')
-rw-r--r--src/ctor.h78
1 files changed, 72 insertions, 6 deletions
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 <class ... Args>
@@ -83,7 +88,8 @@ struct source
std::is_same_v<Args, ctor::toolchain> ||
std::is_same_v<Args, ctor::language> ||
std::is_same_v<Args, ctor::source_type> ||
- std::is_same_v<Args, ctor::output_file>
+ std::is_same_v<Args, ctor::output_file> ||
+ std::is_same_v<Args, ctor::nodist>
) && ...)
constexpr source(Args && ... arg)
{
@@ -109,6 +115,10 @@ struct source
{
source_type = arg;
}
+ else if constexpr(std::is_same_v<Args, ctor::nodist>)
+ {
+ 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<ctor::source>;
@@ -125,7 +136,8 @@ struct header
{
template <class ... Args>
requires ((
- std::is_convertible_v<Args, std::string_view>
+ std::is_convertible_v<Args, std::string_view> ||
+ std::is_same_v<Args, ctor::nodist>
) && ...)
constexpr header(Args && ... arg)
{
@@ -135,19 +147,47 @@ struct header
{
file = arg;
}
- else if constexpr(std::is_same_v<Args, ctor::install>)
+ else if constexpr(std::is_same_v<Args, ctor::nodist>)
{
- install = arg;
+ nodist = arg.value;
}
}(), ...);
}
std::string file;
- ctor::install install;
+ bool nodist{false};
};
using headers = std::vector<ctor::header>;
+struct extra_dist_file
+{
+ template <class ... Args>
+ requires ((
+ std::is_convertible_v<Args, std::string_view> ||
+ std::is_same_v<Args, ctor::nodist>
+ ) && ...)
+ constexpr extra_dist_file(Args && ... arg)
+ {
+ ([&]
+ {
+ if constexpr(std::is_convertible_v<Args, std::string_view>)
+ {
+ file = arg;
+ }
+ else if constexpr(std::is_same_v<Args, ctor::nodist>)
+ {
+ nodist = arg.value;
+ }
+ }(), ...);
+ }
+
+ std::string file;
+ bool nodist{false};
+};
+
+using extra_dist = std::vector<ctor::extra_dist_file>;
+
enum class cxx_opt
{
// gcc/clang
@@ -381,16 +421,32 @@ struct externals
std::vector<std::string> externals;
};
+struct version
+{
+ int major;
+ int minor;
+ int patch;
+ std::string tweak{};
+};
+
+struct project
+{
+ std::string name;
+ ctor::version version;
+};
+
struct build_configuration
{
template <class ... Args>
requires ((
+ std::is_same_v<Args, ctor::project> ||
std::is_same_v<Args, ctor::name> ||
std::is_same_v<Args, ctor::target_type> ||
std::is_same_v<Args, ctor::output_system> ||
std::is_same_v<Args, ctor::target> ||
std::is_same_v<Args, ctor::sources> ||
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::externals> ||
std::is_convertible_v<Args, ctor::GeneratorOneToOne> ||
@@ -405,7 +461,11 @@ struct build_configuration
{
([&]
{
- if constexpr(std::is_same_v<Args, ctor::name>)
+ if constexpr(std::is_same_v<Args, ctor::project>)
+ {
+ project = arg;
+ }
+ else if constexpr(std::is_same_v<Args, ctor::name>)
{
name = arg.name;
}
@@ -429,6 +489,10 @@ struct build_configuration
{
headers = arg;
}
+ else if constexpr(std::is_same_v<Args, ctor::extra_dist>)
+ {
+ extra_dist = arg;
+ }
else if constexpr(std::is_same_v<Args, ctor::depends>)
{
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<std::string> depends; // internal target dependencies
ctor::flags flags;
std::vector<std::string> externals; // externals used by this configuration