summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ctor.h12
-rw-r--r--src/task_cc.cc8
2 files changed, 20 insertions, 0 deletions
diff --git a/src/ctor.h b/src/ctor.h
index 8dd2ddd..f145eef 100644
--- a/src/ctor.h
+++ b/src/ctor.h
@@ -67,6 +67,12 @@ struct output_file
std::string file;
};
+enum class source_type
+{
+ regular,
+ generated,
+};
+
struct source
{
template <class ... Args>
@@ -74,6 +80,7 @@ struct source
std::is_convertible_v<Args, std::string_view> ||
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>
) && ...)
constexpr source(Args && ... arg)
@@ -96,6 +103,10 @@ struct source
{
output = arg.file;
}
+ else if constexpr(std::is_same_v<Args, ctor::source_type>)
+ {
+ source_type = arg;
+ }
}(), ...);
}
@@ -103,6 +114,7 @@ struct source
ctor::toolchain toolchain{ctor::toolchain::any};
ctor::language language{ctor::language::automatic};
std::string output{};
+ ctor::source_type source_type{ctor::source_type::regular};
};
enum class cxx_opt
diff --git a/src/task_cc.cc b/src/task_cc.cc
index 9628455..f81023f 100644
--- a/src/task_cc.cc
+++ b/src/task_cc.cc
@@ -23,6 +23,10 @@ TaskCC::TaskCC(const ctor::build_configuration& config_, const ctor::settings& s
, sourceDir(sourceDir_)
, _source(source)
{
+ if(source.source_type == ctor::source_type::generated)
+ {
+ sourceFile = std::filesystem::path(settings.builddir) / sourceFile;
+ }
sourceFile /= source.file;
std::filesystem::path base = sourceFile.parent_path();
@@ -252,6 +256,10 @@ int TaskCC::clean()
std::vector<std::string> TaskCC::depends() const
{
+ if(_source.source_type == ctor::source_type::generated)
+ {
+ return {sourceFile.string()};
+ }
return {};
}