Stage 'windeployqt'.

This commit is contained in:
Roman Telezhynskyi 2023-01-18 15:04:26 +02:00
parent b26094969d
commit 971869c346
9 changed files with 266 additions and 10 deletions

View File

@ -1,4 +1,5 @@
import qbs.FileInfo
import qbs.Utilities
CppApplication {
Depends { name: "buildconfig" }
@ -24,13 +25,13 @@ CppApplication {
}
Properties {
condition: Qt.core.versionMajor >= 5 && Qt.core.versionMinor < 12
condition: Qt.core.versionMajor >= 5 && Qt.core.versionMinor < 12
cpp.cxxLanguageVersion: "c++11"
}
// Since Qt 5.12 available support for C++17
Properties {
condition: Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 12
condition: Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 12
cpp.cxxLanguageVersion: "c++17"
}
@ -49,8 +50,12 @@ CppApplication {
prefix: project.sourceDirectory + "/dist/win/"
files: {
var files = [];
if (qbs.toolchainType.contains("mingw"))
files.push("msvcr120.dll");
// Minimal supported OpenSSL version since Qt 5.12.4 is 1.1.1.
if (Qt.core.versionMajor >= 5 && Qt.core.versionMinor >= 12 && Qt.core.versionPatch >= 4) {
if (Utilities.versionCompare(Qt.core.version, "5.12.4") >= 0) {
if (qbs.architecture.contains("x86_64")) {
files.push(
"openssl/win64/libcrypto-1_1-x64.dll",
@ -63,7 +68,6 @@ CppApplication {
);
}
} else {
files.push("msvcr120.dll");
if (qbs.architecture.contains("x86_64")) {
files.push(
"openssl/win64/libeay32.dll",

View File

@ -0,0 +1,13 @@
VLib {
Depends { name: "windeployqt"; }
Depends { name: "i18nconfig"; }
buildconfig.staticBuild: false
windeployqt.noVirtualkeyboard: true
Properties {
condition: i18nconfig.limitDeploymentOfQtTranslations
windeployqt.languages: i18nconfig.qtTranslationLocales.join(',')
}
}

View File

@ -3,6 +3,7 @@ import qbs.FileInfo
VApp {
Depends { name: "freedesktop2" }
Depends { name: "tenv" }
Depends { name: "windeployqt"; }
Depends { name: "i18nconfig"; }
version: "0.7.52"
@ -62,4 +63,11 @@ VApp {
return files;
}
}
windeployqt.noVirtualkeyboard: true
Properties {
condition: i18nconfig.limitDeploymentOfQtTranslations
windeployqt.languages: i18nconfig.qtTranslationLocales.join(',')
}
}

View File

@ -0,0 +1,183 @@
import qbs.File
import qbs.FileInfo
import qbs.Environment
import qbs.Utilities
import qbs.ModUtils
/**
This module uses _windeployqt_ program to collect Qt runtime for Windows deployment.
*/
Module {
additionalProductTypes: ["windeployqt"]
property bool artifacts: true
property bool json: false
property string windeployqtArtifact: artifacts ? (json ? "windeployqt.json" : "windeployqt.txt")
: undefined
property string windeployqtProgram: "windeployqt.exe"
property string qmake: undefined
/**
Defines where collected files are being copied. This can be useful to distinguish Qt runtime from project artifacts. Uses
location of the binary if undefined.
*/
property string dir: undefined
property string libdir: undefined
property string plugindir: product.windeployqt.dir !== undefined ? product.windeployqt.dir + "/plugins"
: undefined
property bool debug: false
property bool release: false
property bool pdb: false
property bool force: false
property bool dryRun: false
property bool noPatchqt: false
property bool ignoreLibraryErrors: false
property bool noPlugins: false
property bool noLibraries: false
property string languages: undefined
property bool noTranslations: false
property bool noSystemD3dCompiler: false
property bool compilerRuntime: false
property bool noVirtualkeyboard: false
property bool noCompilerRuntime: false
property bool noOpenglSw: false
property string list: undefined
property int verbose: undefined
Depends { name: "Qt.core" }
Rule {
// alwaysRun: true
condition: product.qbs.targetOS.contains("windows")
inputs: product.type.contains("dynamiclibrary") ? ["dynamiclibrary"] : ["application"]
prepare: {
var windeployqtProgram = product.windeployqt.windeployqtProgram;
// 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.windeployqtProgram = windeployqtProgram;
cmd.description = "can not invoke '" + windeployqtProgram + "' when '--no-install` options has been set from command line";
cmd.sourceCode = function () {
console.warn("Can not invoke '" + windeployqtProgram + "' when '--no-install` options has been set from command line (tip: remove your build directory entirely after unchecking '--no-install' option)");
}
} else {
var cmdArgs = []
if (Utilities.versionCompare(product.Qt.core.version, "6") >= 0) {
if (product.windeployqt.qmake !== undefined)
cmdArgs.push("--qmake", product.windeployqt.qmake)
if (product.windeployqt.ignoreLibraryErrors)
cmdArgs.push("--ignore-library-errors")
if (!product.windeployqt.noTranslations && product.windeployqt.languages !== undefined)
cmdArgs.push("--translations", product.windeployqt.languages)
}
if (product.windeployqt.dir !== undefined)
cmdArgs.push("--dir", product.windeployqt.dir)
if (product.windeployqt.noLibraries)
cmdArgs.push("--no-libraries")
else if (product.windeployqt.libdir !== undefined)
cmdArgs.push("--libdir", product.windeployqt.libdir)
if (product.windeployqt.noPlugins)
cmdArgs.push("--no-plugins")
else if (product.windeployqt.plugindir !== undefined)
cmdArgs.push("--plugindir", product.windeployqt.plugindir)
if (product.windeployqt.debug)
cmdArgs.push("--debug")
if (product.windeployqt.release)
cmdArgs.push("--release")
if (product.windeployqt.pdb && product.qbs.toolchain.contains("msvc"))
cmdArgs.push("--pdb")
if (product.windeployqt.force)
cmdArgs.push("--force")
if (product.windeployqt.dryRun)
cmdArgs.push("--dry-run")
if (product.windeployqt.noPatchqt)
cmdArgs.push("--no-patchqt")
if (product.windeployqt.noTranslations)
cmdArgs.push("--no-translations")
if (product.windeployqt.noSystemD3dCompiler)
cmdArgs.push("--no-system-d3d-compiler")
if (product.windeployqt.compilerRuntime)
cmdArgs.push("--compiler-runtime")
else if (product.windeployqt.noCompilerRuntime)
cmdArgs.push("--no-compiler-runtime")
if (product.windeployqt.noVirtualkeyboard)
cmdArgs.push("--no-virtualkeyboard")
if (product.windeployqt.json)
cmdArgs.push("--json")
if (product.windeployqt.noOpenglSw)
cmdArgs.push("--no-opengl-sw")
if (product.windeployqt.list !== undefined)
cmdArgs.push("--list", product.windeployqt.list)
if (product.windeployqt.verbose !== undefined)
cmdArgs.push("--verbose", product.windeployqt.verbose)
cmdArgs.push(product.installDir + "/" + input.fileName);
var cmd = new Command(product.Qt.core.binPath + "/" + windeployqtProgram, cmdArgs);
cmd.jobPool = "windeployqt";
cmd.description = "invoking '" + windeployqtProgram;
cmd.stdoutFilePath = product.buildDirectory + "/" + product.windeployqt.windeployqtArtifact;
}
cmd.workingDirectory = product.qbs.installRoot;
cmd.highlight = "filegen";
return [cmd]
}
Artifact {
filePath: product.buildDirectory + "/" + product.windeployqt.windeployqtArtifact
fileTags: ["windeployqt", "windeployqt.json", "json"]
}
}
JobLimit {
jobPool: "windeployqt"
jobCount: 1
}
}

View File

@ -267,4 +267,15 @@ VToolApp {
prefix: product.sourceDirectory + "/share/resources/"
files: "puzzle.rc"
}
Group {
name: "win deploy"
condition: qbs.targetOS.contains("windows")
prefix: project.sourceDirectory + "/dist/win/"
files: [
"layout.ico",
]
qbs.install: true
qbs.installDir: buildconfig.installAppPath
}
}

View File

@ -211,4 +211,16 @@ VToolApp {
prefix: product.sourceDirectory + "/share/resources/"
files: "tape.rc"
}
Group {
name: "win deploy"
condition: qbs.targetOS.contains("windows")
prefix: project.sourceDirectory + "/dist/win/"
files: [
"i-measurements.ico",
"s-measurements.ico",
]
qbs.install: true
qbs.installDir: buildconfig.installAppPath
}
}

View File

@ -286,6 +286,24 @@ VToolApp {
fileTags: "freedesktop.512x512MimetypesIcons"
}
Group {
name: "win deploy"
condition: qbs.targetOS.contains("windows")
prefix: project.sourceDirectory + "/"
files: [
"dist/win/valentina.ico",
"dist/win/pattern.ico",
"dist/win/EUDC.TTE",
"AUTHORS.txt",
"LICENSE_GPL.txt",
"README.txt",
"ChangeLog.txt",
"share/qtlogging.ini"
]
qbs.install: true
qbs.installDir: buildconfig.installAppPath
}
Group {
fileTagsFilter: "qm"
qbs.install: true

View File

@ -1,4 +1,4 @@
VLib {
VDynamicLib {
name: "QMUParserLib"
version: "2.7.0"
files: [
@ -34,10 +34,19 @@ VLib {
cpp.defines: ["QMUPARSER_LIBRARY", 'QMUP_VERSION="' + product.version + '"']
buildconfig.staticBuild: false
Export {
Depends { name: "cpp" }
cpp.includePaths: [exportingProduct.sourceDirectory]
}
Group {
name: "win deploy"
condition: qbs.targetOS.contains("windows")
prefix: product.sourceDirectory + "/"
files: [
"LICENSE_BSD.txt"
]
qbs.install: true
qbs.installDir: buildconfig.installAppPath
}
}

View File

@ -1,4 +1,4 @@
VLib {
VDynamicLib {
Depends { name: "Qt"; submodules: ["gui", "widgets"] }
Depends { name: "VMiscLib" }
@ -41,8 +41,6 @@ VLib {
"checkablemessagebox.h",
]
buildconfig.staticBuild: false
Group {
name: "plugins"
prefix: "plugins/"