summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2026-02-22 16:32:38 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2026-02-22 17:39:06 +0100
commit2855b6e1172d5b544b150bf617b216691801f574 (patch)
tree620e64d83a8ea4e18f0990766f2c8592127cd452 /src
parentdb6c4499ecc23212838f45fc9fa8c0a703d8b85f (diff)
Make it possible to register header files along with the sources.
Diffstat (limited to 'src')
-rw-r--r--src/ctor.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ctor.h b/src/ctor.h
index 182f97a..9320c3d 100644
--- a/src/ctor.h
+++ b/src/ctor.h
@@ -121,6 +121,33 @@ struct source
using sources = std::vector<ctor::source>;
+struct header
+{
+ template <class ... Args>
+ requires ((
+ std::is_convertible_v<Args, std::string_view>
+ ) && ...)
+ constexpr header(Args && ... arg)
+ {
+ ([&]
+ {
+ if constexpr(std::is_convertible_v<Args, std::string_view>)
+ {
+ file = arg;
+ }
+ else if constexpr(std::is_same_v<Args, ctor::install>)
+ {
+ install = arg;
+ }
+ }(), ...);
+ }
+
+ std::string file;
+ ctor::install install;
+};
+
+using headers = std::vector<ctor::header>;
+
enum class cxx_opt
{
// gcc/clang
@@ -363,6 +390,7 @@ struct build_configuration
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::depends> ||
std::is_same_v<Args, ctor::externals> ||
std::is_convertible_v<Args, ctor::GeneratorOneToOne> ||
@@ -397,6 +425,10 @@ struct build_configuration
{
sources = arg;
}
+ else if constexpr(std::is_same_v<Args, ctor::headers>)
+ {
+ headers = arg;
+ }
else if constexpr(std::is_same_v<Args, ctor::depends>)
{
depends = arg.depends;
@@ -441,6 +473,7 @@ struct build_configuration
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
std::vector<std::string> depends; // internal target dependencies
ctor::flags flags;
std::vector<std::string> externals; // externals used by this configuration