blob: c34b0ca74f057089f2a06b30b3dc4d628e4d0626 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
import qbs.File
import qbs.FileInfo
import qbs.TextFile
Project {
name: "p"
CppApplication {
condition: {
var result = qbs.targetPlatform === qbs.hostPlatform;
if (!result)
console.info("targetPlatform differs from hostPlatform");
return result;
}
name: "app"
Depends { name: "installed-header" }
Rule {
multiplex: true
auxiliaryInputs: ["installable"]
Artifact { filePath: "main.cpp"; fileTags: "cpp" }
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.sourceCode = function() {
var f = new TextFile(output.filePath, TextFile.WriteOnly);
f.writeLine("#include <theheader.h>");
f.writeLine("int main() {");
f.writeLine(" f();");
f.writeLine("}");
f.close();
};
return cmd;
}
}
}
Product {
name: "installed-header"
type: ["header"]
property string installDir: "include"
qbs.installPrefix: ""
Group {
fileTagsFilter: "header"
qbs.install: true
qbs.installDir: installDir
}
Export {
Depends { name: "cpp" }
cpp.includePaths: FileInfo.joinPaths(qbs.installRoot, exportingProduct.installDir);
}
Rule {
multiplex: true
Artifact { filePath: "theheader.h.in"; fileTags: "header.in" }
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Creating " + output.fileName;
cmd.sourceCode = function() {
for (var i = 0; i < 1000; ++i) { // Artificial delay.
var file = new TextFile(output.filePath, TextFile.WriteOnly);
file.writeLine("#include <iostream>");
file.writeLine("inline void f() {");
file.writeLine(' std::cout << "f-impl" << std::endl;');
file.writeLine("}");
file.close();
}
};
return [cmd];
}
}
Rule {
inputs: "header.in"
Artifact { filePath: "theheader.h"; fileTags: "header" }
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Creating " + output.fileName;
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); };
return [cmd];
}
}
}
}
|