From b69b569ff43299dec625d573b08fec642039afea Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sat, 27 Mar 2021 23:13:27 +0100 Subject: Fix accessing binaries from libexec Starting from Qt 6.1, some binaries were moved to libexec/ directory from bin/ (e.g. moc, rcc, uic). Fixes: QBS-1636 Change-Id: Iaa329773a3ffcea5f09c0663dd4159d839980525 Reviewed-by: Christian Kandeler --- share/qbs/module-providers/Qt/setup-qt.js | 9 +++++++++ share/qbs/module-providers/Qt/templates/core.qbs | 7 +++++-- share/qbs/module-providers/Qt/templates/gui.qbs | 8 +++++--- share/qbs/module-providers/Qt/templates/moc.js | 5 ++++- share/qbs/module-providers/Qt/templates/quick.js | 3 ++- share/qbs/module-providers/Qt/templates/rcc.js | 8 ++++++++ 6 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 share/qbs/module-providers/Qt/templates/rcc.js diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js index 619ccf2ef..5cf1bcb44 100644 --- a/share/qbs/module-providers/Qt/setup-qt.js +++ b/share/qbs/module-providers/Qt/setup-qt.js @@ -267,6 +267,10 @@ function getQtProperties(qmakeFilePath, qbs) { qtProps.mkspecBasePath = FileInfo.joinPaths (pathQueryValue(queryResult, "QT_INSTALL_DATA"), "mkspecs"); } + + if (Utilities.versionCompare(qtProps.qtVersion, "6") >= 0) + qtProps.libExecPath = pathQueryValue(queryResult, "QT_INSTALL_LIBEXECS"); + if (!File.exists(qtProps.mkspecBasePath)) throw "Cannot extract the mkspecs directory."; @@ -1339,6 +1343,7 @@ function replaceSpecialValues(content, module, qtProps, abi) { binPath: ModUtils.toJSLiteral(qtProps.binaryPath), installPath: ModUtils.toJSLiteral(qtProps.installPath), libPath: ModUtils.toJSLiteral(qtProps.libraryPath), + libExecPath: ModUtils.toJSLiteral(qtProps.libExecPath), pluginPath: ModUtils.toJSLiteral(qtProps.pluginPath), incPath: ModUtils.toJSLiteral(qtProps.includePath), docPath: ModUtils.toJSLiteral(qtProps.documentationPath), @@ -1541,6 +1546,8 @@ function setupOneQt(qmakeFilePath, outputBaseDir, uniquify, location, qbs) { allFiles); copyTemplateFile("qdoc.js", qbsQtModuleDir, qtProps, androidAbis[a], location, allFiles); + copyTemplateFile("rcc.js", qbsQtModuleDir, qtProps, androidAbis[a], location, + allFiles); } else if (module.qbsName === "gui") { moduleTemplateFileName = "gui.qbs"; } else if (module.qbsName === "scxml") { @@ -1564,6 +1571,8 @@ function setupOneQt(qmakeFilePath, outputBaseDir, uniquify, location, qbs) { moduleTemplateFileName = "quick.qbs"; copyTemplateFile("quick.js", qbsQtModuleDir, qtProps, androidAbis[a], location, allFiles); + copyTemplateFile("rcc.js", qbsQtModuleDir, qtProps, androidAbis[a], location, + allFiles); } else if (module.isPlugin) { moduleTemplateFileName = "plugin.qbs"; } else { diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs index 19c2d0239..2e810eeed 100644 --- a/share/qbs/module-providers/Qt/templates/core.qbs +++ b/share/qbs/module-providers/Qt/templates/core.qbs @@ -5,6 +5,7 @@ import qbs.Utilities import qbs.Xml import "moc.js" as Moc import "qdoc.js" as Qdoc +import "rcc.js" as Rcc Module { condition: (qbs.targetPlatform === targetPlatform || isCombinedUIKitBuild) @@ -41,12 +42,14 @@ Module { property path installPath: @installPath@ property path incPath: @incPath@ property path libPath: @libPath@ + property path libExecPath: @libExecPath@ property path pluginPath: @pluginPath@ property string mkspecName: @mkspecName@ property path mkspecPath: @mkspecPath@ property string mocName: "moc" property stringList mocFlags: [] property string lreleaseName: "lrelease" + property string rccName: "rcc" property string qdocName: versionMajor >= 5 ? "qdoc" : "qdoc3" property stringList qdocEnvironment property path docPath: @docPath@ @@ -433,7 +436,7 @@ Module { "-o", output.filePath]; if (input.Qt.core.enableBigResources) args.push("-pass", "1"); - var cmd = new Command(product.Qt.core.binPath + '/rcc', args); + var cmd = new Command(Rcc.fullPath(product), args); cmd.description = "rcc " + (input.Qt.core.enableBigResources ? "(pass 1) " : "") + input.fileName; @@ -464,7 +467,7 @@ Module { } var qrcArtifact = findChild(input, function(c) { return c.fileTags.contains("qrc"); }); var cppArtifact = findChild(input, function(c) { return c.fileTags.contains("cpp"); }); - var cmd = new Command(product.Qt.core.binPath + '/rcc', + var cmd = new Command(Rcc.fullPath(product), [qrcArtifact.filePath, "-temp", input.filePath, "-name", FileInfo.completeBaseName(input.filePath), diff --git a/share/qbs/module-providers/Qt/templates/gui.qbs b/share/qbs/module-providers/Qt/templates/gui.qbs index a3c427175..1d45c6f1e 100644 --- a/share/qbs/module-providers/Qt/templates/gui.qbs +++ b/share/qbs/module-providers/Qt/templates/gui.qbs @@ -23,9 +23,11 @@ QtModule { } prepare: { - var cmd = new Command(ModUtils.moduleProperty(product, "binPath") + '/' - + ModUtils.moduleProperty(product, "uicName"), - [input.filePath, '-o', output.filePath]) + var uicPath = Utilities.versionCompare(product.Qt.gui.version, "6.1") < 0 + ? product.Qt.core.binPath + '/' + product.Qt.gui.uicName + : product.Qt.core.libExecPath + '/' + product.Qt.gui.uicName; + + var cmd = new Command(uicPath, [input.filePath, '-o', output.filePath]); cmd.description = 'uic ' + input.fileName; cmd.highlight = 'codegen'; return cmd; diff --git a/share/qbs/module-providers/Qt/templates/moc.js b/share/qbs/module-providers/Qt/templates/moc.js index 92983e4f7..7d230267c 100644 --- a/share/qbs/module-providers/Qt/templates/moc.js +++ b/share/qbs/module-providers/Qt/templates/moc.js @@ -29,6 +29,7 @@ ****************************************************************************/ var ModUtils = require("qbs.ModUtils"); +var Utilities = require("qbs.Utilities"); function args(product, input, outputs) { @@ -78,7 +79,9 @@ function args(product, input, outputs) function fullPath(product) { - return product.Qt.core.binPath + '/' + product.Qt.core.mocName; + if (Utilities.versionCompare(product.Qt.core.version, "6.1") < 0) + return product.Qt.core.binPath + '/' + product.Qt.core.mocName; + return product.Qt.core.libExecPath + '/' + product.Qt.core.mocName; } function outputArtifacts(project, product, inputs, input) diff --git a/share/qbs/module-providers/Qt/templates/quick.js b/share/qbs/module-providers/Qt/templates/quick.js index 76f2e9e53..ad433736c 100644 --- a/share/qbs/module-providers/Qt/templates/quick.js +++ b/share/qbs/module-providers/Qt/templates/quick.js @@ -30,13 +30,14 @@ var FileInfo = require("qbs.FileInfo"); var Process = require("qbs.Process"); +var Rcc = require("rcc.js"); function scanQrc(product, qrcFilePath) { var absInputDir = FileInfo.path(qrcFilePath); var result = []; var process = new Process(); try { - var rcc = FileInfo.joinPaths(product.Qt.core.binPath, 'rcc' + product.cpp.executableSuffix); + var rcc = FileInfo.joinPaths(Rcc.fullPath(product) + product.cpp.executableSuffix); var exitCode = process.exec(rcc, ["--list", qrcFilePath], true); for (;;) { var line = process.readLine(); diff --git a/share/qbs/module-providers/Qt/templates/rcc.js b/share/qbs/module-providers/Qt/templates/rcc.js new file mode 100644 index 000000000..89c57d99b --- /dev/null +++ b/share/qbs/module-providers/Qt/templates/rcc.js @@ -0,0 +1,8 @@ +var Utilities = require("qbs.Utilities"); + +function fullPath(product) +{ + if (Utilities.versionCompare(product.Qt.core.version, "6.1") < 0) + return product.Qt.core.binPath + '/' + product.Qt.core.rccName; + return product.Qt.core.libExecPath + '/' + product.Qt.core.rccName; +} -- cgit v1.2.3