Module macdeployqt.

This commit is contained in:
Roman Telezhynskyi 2023-01-27 12:08:47 -08:00
parent 766aae447d
commit 4b6f68ff80
3 changed files with 130 additions and 6 deletions

View File

@ -4,10 +4,11 @@ import qbs.File
VApp { VApp {
Depends { name: "freedesktop2" } Depends { name: "freedesktop2" }
Depends { name: "tenv" } Depends { name: "tenv" }
Depends { name: "windeployqt"; } Depends { name: "windeployqt"; condition: qbs.targetOS.contains("windows") }
Depends { name: "i18nconfig"; } Depends { name: "i18nconfig"; }
Depends { name: "i18n"; } Depends { name: "i18n"; }
Depends { name: "ib"; condition: qbs.targetOS.contains("macos") } Depends { name: "ib"; condition: qbs.targetOS.contains("macos") }
Depends { name: "macdeployqt"; condition: qbs.targetOS.contains("macos") }
version: "0.7.52" version: "0.7.52"
install: true install: true
@ -189,11 +190,15 @@ VApp {
} }
} }
Properties {
condition: qbs.targetOS.contains("windows")
windeployqt.noVirtualkeyboard: true windeployqt.noVirtualkeyboard: true
}
Properties { Properties {
condition: qbs.targetOS.contains("macos") condition: qbs.targetOS.contains("macos")
ib.appIconName: targetName ib.appIconName: targetName
macdeployqt.targetApps: ["Tape", "Puzzle"]
} }
Properties { Properties {

View File

@ -0,0 +1,106 @@
import qbs.File
import qbs.FileInfo
import qbs.Environment
import qbs.Utilities
import qbs.ModUtils
/**
This module uses _macdeployqt_ program to collect Qt runtime for MacOS deployment.
*/
Module {
additionalProductTypes: ["macdeployqt"]
property bool artifacts: true
property string macdeployqtArtifact: artifacts ? "maceployqt.txt" : undefined
property string macdeployqtProgram: "macdeployqt"
property bool noPlugins: false
property int verbose: undefined
property bool noStrip: true
property bool useDebugLibs: false
property bool alwaysOverwrite: false
property bool appstoreCompliant: false
property string libpath: undefined
property stringList targetApps: undefined
Rule {
// alwaysRun: true
multiplex: true
condition: product.qbs.targetOS.contains("macos") && product.bundle.isBundle && (product.buildconfig.enableMultiBundle || (!product.buildconfig.enableMultiBundle && product.primaryApp))
inputs: ["bundle.content"]
prepare: {
var macdeployqtProgram = product.macdeployqt.macdeployqtProgram;
// Checking if directory exists as a dirty workaround to check if `--no-install` options has been set from command line.
if (!File.exists(product.qbs.installRoot)) {
var cmd = new JavaScriptCommand();
cmd.macdeployqtProgram = macdeployqtProgram;
cmd.description = "can not invoke '" + macdeployqtProgram + "' when '--no-install` options has been set from command line";
cmd.sourceCode = function () {
console.warn("Can not invoke '" + macdeployqtProgram + "' when '--no-install` options has been set from command line (tip: remove your build directory entirely after unchecking '--no-install' option)");
}
} else {
const installRoot = product.qbs.installRoot + product.qbs.installPrefix + "/" + product.buildconfig.installAppPath;
var cmdArgs = [installRoot + "/" + product.targetName + ".app"];
if (product.macdeployqt.noPlugins)
cmdArgs.push("--no-plugins");
if (product.macdeployqt.verbose !== undefined)
cmdArgs.push("--verbose", product.macdeployqt.verbose);
if (product.macdeployqt.noStrip)
cmdArgs.push("-no-strip");
if (product.macdeployqt.useDebugLibs)
cmdArgs.push("-use-debug-libs");
if (product.macdeployqt.alwaysOverwrite)
cmdArgs.push("-always-overwrite");
if (product.macdeployqt.appstoreCompliant)
cmdArgs.push("-appstore-compliant");
if (product.macdeployqt.libpath !== undefined)
cmdArgs.push("--libpath", product.macdeployqt.libpath);
if (product.macdeployqt.targetApps !== undefined && !product.buildconfig.enableMultiBundle && product.primaryApp)
{
product.macdeployqt.targetApps.forEach(function(targetApp) {
cmdArgs.push("-executable=\"" + installRoot + "/" + product.targetName + ".app/Contents/MacOS/" + targetApp + "\"");
});
}
var cmd = new Command(product.Qt.core.binPath + "/" + macdeployqtProgram, cmdArgs);
cmd.jobPool = "macdeployqt";
cmd.description = "invoking '" + macdeployqtProgram;
cmd.stdoutFilePath = product.buildDirectory + "/" + product.macdeployqt.macdeployqtArtifact;
}
cmd.workingDirectory = product.qbs.installRoot;
cmd.highlight = "filegen";
return [cmd]
}
Artifact {
filePath: product.buildDirectory + "/" + product.macdeployqt.macdeployqtArtifact
fileTags: ["macdeployqt"]
}
}
JobLimit {
jobPool: "macdeployqt"
jobCount: 1
}
}

View File

@ -98,7 +98,12 @@ VToolApp {
] ]
fileTags: ["multisize_tables"] fileTags: ["multisize_tables"]
qbs.install: true qbs.install: true
qbs.installDir: buildconfig.installDataPath + "/tables/multisize" qbs.installDir: {
if (qbs.targetOS.contains("macos") && !buildconfig.enableMultiBundle)
return buildconfig.installAppPath + "/Valentina.app/Contents/Resources/tables/multisize"
return buildconfig.installDataPath + "/tables/multisize"
}
} }
Group { Group {
@ -110,7 +115,12 @@ VToolApp {
] ]
fileTags: ["measurements_templates"] fileTags: ["measurements_templates"]
qbs.install: true qbs.install: true
qbs.installDir: buildconfig.installDataPath + "/tables/templates" qbs.installDir: {
if (qbs.targetOS.contains("macos") && !buildconfig.enableMultiBundle)
return buildconfig.installAppPath + "/Valentina.app/Contents/Resources/tables/templates"
return buildconfig.installDataPath + "/tables/templates"
}
} }
Group { Group {
@ -196,7 +206,10 @@ VToolApp {
qbs.installDir: { qbs.installDir: {
if (qbs.targetOS.contains("unix") && !qbs.targetOS.contains("macos")) if (qbs.targetOS.contains("unix") && !qbs.targetOS.contains("macos"))
return "share/valentina/"; return "share/valentina/";
else
if (qbs.targetOS.contains("macos") && !buildconfig.enableMultiBundle)
return buildconfig.installAppPath + "/Valentina.app/Contents/Resources"
return buildconfig.installDataPath + "/"; return buildconfig.installDataPath + "/";
} }
} }