Skip to content

Instantly share code, notes, and snippets.

@orgads
Created March 28, 2016 07:09
Show Gist options
  • Save orgads/8f759a46051e050011d9 to your computer and use it in GitHub Desktop.
Save orgads/8f759a46051e050011d9 to your computer and use it in GitHub Desktop.
Product {
name: "UnitTests"
property string absCommon: FileInfo.joinPaths(buildDirectory, "Common");
Rule {
id: unitTestEnabled
inputs: ["qbs"]
Artifact {
filePath: FileInfo.joinPaths(product.absCommon, "UnitTestEnabled.h")
fileTags: ["hpp"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = 'generating ' + output.fileName;
cmd.highlight = 'codegen';
cmd.testsEnabled = project.gtest;
cmd.sourceCode = function() {
console.error(output.filePath)
var file = new TextFile(output.filePath, TextFile.WriteOnly);
file.truncate();
if (testsEnabled)
file.write("#define WITH_TESTS 1\n");
file.close();
}
return cmd;
}
}
Export {
Depends { name: "cpp" }
cpp.includePaths: product.absCommon
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment