Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import qbs.TextFile
- Project {
- Product {
- name: "gen1"
- type: ["cpp","cpp-gen"]
- Depends { name: "cpp" }
- Rule {
- multiplex: true
- Artifact {
- fileTags: ["cpp","cpp-gen"]
- filePath: "gen1.cpp"
- }
- prepare: {
- //Dbg.xlog(arguments,"arguments",1);
- var cmd = new JavaScriptCommand();
- cmd.dst = output.filePath;
- cmd.txt = "#include <iostream>\n struct Gen1 { Gen1() { std::cout << \"Gen1 ctor\" << std::endl; } } gen1;\n";
- cmd.description = 'generate ' + cmd.dst
- cmd.sourceCode = function(){
- var file = new TextFile( dst, TextFile.WriteOnly );
- file.write( txt );
- file.close();
- };
- return [cmd];
- }
- }
- Export {
- Group {
- fileTagsFilter: ["cpp-gen","cpp"]
- //filesAreTargets: true;
- }
- }
- }
- CppApplication {
- name: "a"
- consoleApplication: true
- Depends { name: "gen1" }
- Rule {
- multiplex: true
- Artifact {
- fileTags: ["cpp"]
- filePath: "a.cpp"
- }
- prepare: {
- var cmd = new JavaScriptCommand();
- cmd.dst = output.filePath;
- cmd.txt = "#include <iostream>\n int main() { std::cout << \"main() called\" << std::endl; }\n";
- cmd.description = 'generate ' + cmd.dst
- cmd.sourceCode = function(){
- var file = new TextFile( dst, TextFile.WriteOnly );
- file.write( txt );
- file.close();
- };
- return [cmd];
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement