49 lines
1.6 KiB
QML
49 lines
1.6 KiB
QML
import qbs
|
|
import qbs.FileInfo
|
|
|
|
Module {
|
|
Depends { name: "cpp" }
|
|
Depends { name: "Qt.core" }
|
|
|
|
FileTagger {
|
|
patterns: "*.hxx"
|
|
fileTags: ["odb"]
|
|
}
|
|
|
|
Rule {
|
|
inputs: ["odb"]
|
|
Artifact {
|
|
// filePath: FileInfo.baseName(input.fileName)+ "-odb.hxx"
|
|
filePath: FileInfo.cleanPath(input.filePath + "/../" ) + "/" + FileInfo.baseName(input.fileName) + "-odb.hxx"
|
|
fileTags: ["hpp"]
|
|
}
|
|
Artifact {
|
|
// filePath: FileInfo.baseName(input.fileName) + "-odb.cxx"
|
|
filePath: {
|
|
// console.error("THIS ART "+FileInfo.cleanPath(input.filePath + "/../") + "/" + FileInfo.baseName(input.fileName) + "-odb.cxx")
|
|
return FileInfo.cleanPath(input.filePath + "/../") + "/" + FileInfo.baseName(input.fileName) + "-odb.cxx"}
|
|
fileTags: ["cpp"]
|
|
}
|
|
|
|
prepare: {
|
|
var cmd = new Command("odb", [
|
|
"--std", "c++11",
|
|
"-d", "sqlite",
|
|
"--generate-query",
|
|
"--generate-schema",
|
|
"--generate-prepared",
|
|
// "--include-prefix", FileInfo.cleanPath(input.filePath + "/../"),
|
|
// "--output-dir", product.Qt.core.qmDir,
|
|
"--output-dir", FileInfo.cleanPath(input.filePath + "/../"),
|
|
input.filePath,
|
|
]);
|
|
cmd.description = "Generating ODB files for " + input.fileName;
|
|
|
|
console.error(cmd.arguments)
|
|
|
|
return [cmd];
|
|
}
|
|
}
|
|
cpp.includePaths: [ project.sourceDirectory, product.Qt.core.qmDir ]
|
|
}
|