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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
import qbs 1.0
import qbs.Environment
import qbs.File
import qbs.FileInfo
QtcLibrary {
name: "GLSL"
property bool autoGenerateParser: Environment.getEnv("QTC_GLSL_AUTOGENERATE")
cpp.defines: base.concat([
"GLSL_LIBRARY"
])
cpp.includePaths: base.concat([sourceDirectory])
Depends { name: "Qt.gui" }
files: [
"glsl.h",
"glslast.cpp",
"glslast.h",
"glslastdump.cpp",
"glslastdump.h",
"glslastvisitor.cpp",
"glslastvisitor.h",
"glslengine.cpp",
"glslengine.h",
"glslkeywords.cpp",
"glsllexer.cpp",
"glsllexer.h",
"glslmemorypool.cpp",
"glslmemorypool.h",
"glslsemantic.cpp",
"glslsemantic.h",
"glslsymbol.cpp",
"glslsymbol.h",
"glslsymbols.cpp",
"glslsymbols.h",
"glsltype.cpp",
"glsltype.h",
"glsltypes.cpp",
"glsltypes.h",
]
Group {
name: "generated parser files"
condition: !autoGenerateParser
files: [
"glslparser.cpp",
"glslparser.h",
"glslparsertable.cpp",
"glslparsertable_p.h",
]
}
Group {
fileTags: ["qlalrInput"]
files: [ "glsl.g" ]
}
// Necessary because qlalr generates its outputs in the working directory,
// and we want the input file to appear as a relative path in the generated files.
Rule {
inputs: ["qlalrInput"]
condition: product.autoGenerateParser
Artifact { filePath: input.fileName; fileTags: ["qlalrInput.real"] }
prepare: {
var cmd = new JavaScriptCommand();
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }
cmd.silent = true;
return [cmd];
}
}
Rule {
inputs: ["qlalrInput.real"]
condition: product.autoGenerateParser
Artifact { filePath: "glslparsertable_p.h"; fileTags: ["hpp"] }
Artifact { filePath: "glslparsertable.cpp"; fileTags: ["cpp"] }
Artifact { filePath: "glslparser.h"; fileTags: ["hpp"] }
Artifact { filePath: "glslparser.cpp"; fileTags: ["cpp"]}
prepare: {
var inputFile = "./" + input.fileName;
var qlalr = FileInfo.joinPaths(product.Qt.core.binPath, "qlalr")
var generateCmd = new Command(qlalr, ["--qt", "--no-debug", inputFile]);
generateCmd.workingDirectory = product.buildDirectory;
generateCmd.description = "generating glsl parser";
var copyCmd = new JavaScriptCommand();
copyCmd.sourceCode = function() {
var tags = ["hpp", "cpp"];
for (var i = 0; i < tags.length; ++i) {
var artifacts = outputs[tags[i]];
for (var j = 0; j < artifacts.length; ++j) {
var artifact = artifacts[j];
File.copy(artifact.filePath, FileInfo.joinPaths(product.sourceDirectory,
artifact.fileName));
}
}
};
copyCmd.silent = true;
return [generateCmd, copyCmd];
}
}
}
|