Учимся пользоваться odb в нашем меленьком проекте
This commit was merged in pull request #3.
This commit is contained in:
48
qbs/modules/odbModule/odbModule.qbs
Normal file
48
qbs/modules/odbModule/odbModule.qbs
Normal file
@@ -0,0 +1,48 @@
|
||||
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 ]
|
||||
}
|
||||
Reference in New Issue
Block a user