Hello.
I recently needed to develop a rule for a sip generator (see below).
Basically, the rule works well, but yesterday it failed. At the output,
sip-generator create 6 cpp-files of the following format:
sip_corepartX.cpp (this is justified from the point of view of parallel
compilation, cpp-file sizes can be tens of megabytes). These 6 cpp-files
are reflected in the outputArtifacts parameter. However, yesterday I
came across a small sip-file, and the generated cpp-files turned out to
be not 6, but only 5. Naturally, my rule failed.
Question: how can I resolve my situation?
Of course, I can tell the sip-generator to create fewer cpp-files
(parameter -j), but I would like to understand - are there other ways?
For example, to ignore section
{
filePath: generatedFilesDir + "/sip" + moduleSipName + "part5.cpp",
fileTags: ["cpp"],
cpp: {
cxxFlags: sipCxxFlags
}
}
if the file ("sip" + moduleSipName + "part5.cpp") does not exist
--
BR, Pavel Karelin
Rule {
multiplex: true
inputs: ["sip"]
outputFileTags: ["cpp", "hpp", "pyi"]
outputArtifacts: {
var baseSipFile = product.sip.baseSipFile;
var moduleSipName = product.sip.moduleSipName
var generatedFilesDir = product.sip.generatedFilesDir
var baseSipName = FileInfo.baseName(baseSipFile);
//console.info("sip_corepart: " + generatedFilesDir +
"/sip" + moduleSipName + "part0.cpp")
//console.info("sip 1 :")
var sipCxxFlags = [
"-Wno-deprecated-declarations",
"-Wno-deprecated",
"-Wno-unused-variable",
"-Wno-switch",
//"-Wno-unused-function",
//"-Wno-unused-but-set-variable",
//"-Wno-unused-parameter",
]
return [{ // sip_corepart0.cpp
filePath: generatedFilesDir + "/sip" + moduleSipName +
"part0.cpp",
fileTags: ["cpp"],
cpp: {
cxxFlags: sipCxxFlags
}
},{
filePath: generatedFilesDir + "/sip" + moduleSipName +
"part1.cpp",
fileTags: ["cpp"],
cpp: {
cxxFlags: sipCxxFlags
}
},{
filePath: generatedFilesDir + "/sip" + moduleSipName +
"part2.cpp",
fileTags: ["cpp"],
cpp: {
cxxFlags: sipCxxFlags
}
},{
filePath: generatedFilesDir + "/sip" + moduleSipName +
"part3.cpp",
fileTags: ["cpp"],
cpp: {
cxxFlags: sipCxxFlags
}
},{
filePath: generatedFilesDir + "/sip" + moduleSipName +
"part4.cpp",
fileTags: ["cpp"],
cpp: {
cxxFlags: sipCxxFlags
}
},{
filePath: generatedFilesDir + "/sip" + moduleSipName +
"part5.cpp",
fileTags: ["cpp"],
cpp: {
cxxFlags: sipCxxFlags
}
},{ // sipAPI_core.h
filePath: generatedFilesDir + "/sipAPI" + moduleSipName
+ ".h",
fileTags: ["hpp"],
cpp: {
cxxFlags: sipCxxFlags
}
},{ // core.pyi
filePath: project.buildDirectory + "/python/" +
baseSipName + ".pyi",
fileTags: ["pyi"],
}];
}
prepare: {
var baseSipFile = product.sip.baseSipFile;
var moduleSipName = product.sip.moduleSipName;
var generatedFilesDir = product.sip.generatedFilesDir;
var baseSipName = FileInfo.baseName(baseSipFile);
// usr/bin/sip -w -e -x ANDROID -x ARM -x MOBILITY_LOCATION
-n sip -t WS_X11 -t Qt_5_12_4 -g -o
// -a /home/hkarel/CProjects/QGIS/build2/python/qgis.core.api
// -n sip
// -y
/home/hkarel/CProjects/QGIS/build2/output/python/qgis/core.pyi
// -j 6
// -c /home/hkarel/CProjects/QGIS/build2/python/core
// -I /home/hkarel/CProjects/QGIS/build2/python/core
// -I /usr/share/sip/PyQt5
// /home/hkarel/CProjects/QGIS/build2/python/core/core.sip
var args = ["-w", "-e", "-g", "-o", "-j", "6", "-n", "sip"];
args = args.concat(["-x", "ANDROID", "-x", "ARM", "-x",
"MOBILITY_LOCATION"]);
args = args.concat(["-t", "WS_X11", "-t", "Qt_5_12_4"])
args.push("-c");
args.push(generatedFilesDir);
args.push("-I");
args.push(generatedFilesDir);
args.push("-I");
args.push(project.buildDirectory + "/python");
args.push("-I");
args.push("/usr/share/sip/PyQt5");
args.push("-y");
args.push(project.buildDirectory + "/python/" + baseSipName
+ ".pyi");
args.push(generatedFilesDir + "/" + baseSipFile);
//File.makePath(generatedFilesDir);
//console.info("sip 0 : " + args)
var cmd = new Command("/usr/bin/sip", args);
cmd.workingDirectory = project.buildDirectory + "/python";
cmd.description = "sip code generation";
cmd.highlight = "codegen";
return cmd;
}
}
_______________________________________________
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs