GLSL: Run qlalr generator on demand with qbs

Done-with: Christian Kandeler
Change-Id: I67cbed82afa238d31cb7070e35ec980ae9b9b32f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-01-05 15:43:34 +01:00
parent 1a8f5312a1
commit a44d7b9ced

View File

@@ -1,4 +1,5 @@
import qbs 1.0 import qbs 1.0
import qbs.FileInfo
QtcLibrary { QtcLibrary {
name: "GLSL" name: "GLSL"
@@ -10,7 +11,6 @@ QtcLibrary {
Depends { name: "Qt.gui" } Depends { name: "Qt.gui" }
files: [ files: [
"glsl.g",
"glsl.h", "glsl.h",
"glslast.cpp", "glslast.cpp",
"glslast.h", "glslast.h",
@@ -25,10 +25,6 @@ QtcLibrary {
"glsllexer.h", "glsllexer.h",
"glslmemorypool.cpp", "glslmemorypool.cpp",
"glslmemorypool.h", "glslmemorypool.h",
"glslparser.cpp",
"glslparser.h",
"glslparsertable.cpp",
"glslparsertable_p.h",
"glslsemantic.cpp", "glslsemantic.cpp",
"glslsemantic.h", "glslsemantic.h",
"glslsymbol.cpp", "glslsymbol.cpp",
@@ -40,4 +36,39 @@ QtcLibrary {
"glsltypes.cpp", "glsltypes.cpp",
"glsltypes.h", "glsltypes.h",
] ]
Group {
fileTags: ["qlalrInput"]
files: [ "glsl.g" ]
}
Rule {
inputs: ["qlalrInput"]
Artifact {
filePath: FileInfo.joinPaths(product.sourceDirectory, "glslparsertable_p.h")
fileTags: ["hpp"]
}
Artifact {
filePath: FileInfo.joinPaths(product.sourceDirectory, "glslparsertable.cpp")
fileTags: ["cpp"]
}
Artifact {
filePath: FileInfo.joinPaths(product.sourceDirectory, "glslparser.h")
fileTags: ["hpp"]
}
Artifact {
filePath: FileInfo.joinPaths(product.sourceDirectory, "glslparser.cpp")
fileTags: ["cpp"]
}
prepare: {
// Keep the input file path relative, so it's consistent with
// make-parser.sh and no absolute paths end up in e.g. glslparser.cpp.
var inputFile = "./" + inputs["qlalrInput"][0].fileName
var qlalr = FileInfo.joinPaths(product.Qt.core.binPath, "qlalr")
var generateCmd = new Command(qlalr, ["--qt", "--no-debug", inputFile]);
generateCmd.workingDirectory = product.sourceDirectory;
generateCmd.description = "generating glsl parser";
return generateCmd;
}
}
} }