Possibly the circularity can be broken by having the object file as the target artifact of a dedicated project, e.g. something like this (sketch, untested):
Project {
Product {
name: "dep"
type: "obj"
Depends { name: "cpp" }
files: "myfile.c"
}
Product {
Depends { name: "dep" }
Depends { name: "cpp" }
cpp.includePaths: product.buildDirectory // So the generated header will be found
Rule {
inputsFromDependencies: "obj"
Artifact { filePath: "theHeader.h"; fileTags: "hpp" }
prepare: {
var cmd = new Command("xxd", [input.filePath, output.filePath]);
cmd.description = "generating " + output.fileName;
return cmd;
}
}
}
}
Possibly the circularity can be broken by having the object file as the target artifact of a dedicated project, e.g. something like this (sketch, untested):