diff --git a/qbs/imports/VApp.qbs b/qbs/imports/VApp.qbs index 89e6dde61..f115517e9 100644 --- a/qbs/imports/VApp.qbs +++ b/qbs/imports/VApp.qbs @@ -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", diff --git a/qbs/imports/VDynamicLib.qbs b/qbs/imports/VDynamicLib.qbs new file mode 100644 index 000000000..9962695d3 --- /dev/null +++ b/qbs/imports/VDynamicLib.qbs @@ -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(',') + } +} diff --git a/qbs/imports/VToolApp.qbs b/qbs/imports/VToolApp.qbs index 892c0d083..76cba1734 100644 --- a/qbs/imports/VToolApp.qbs +++ b/qbs/imports/VToolApp.qbs @@ -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(',') + } } diff --git a/qbs/modules/windeployqt/windeployqt.qbs b/qbs/modules/windeployqt/windeployqt.qbs new file mode 100644 index 000000000..d87584ad6 --- /dev/null +++ b/qbs/modules/windeployqt/windeployqt.qbs @@ -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 + } +} diff --git a/src/app/puzzle/puzzle.qbs b/src/app/puzzle/puzzle.qbs index 0172f9535..4b25b509f 100644 --- a/src/app/puzzle/puzzle.qbs +++ b/src/app/puzzle/puzzle.qbs @@ -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 + } } diff --git a/src/app/tape/tape.qbs b/src/app/tape/tape.qbs index 630833dee..c856f377c 100644 --- a/src/app/tape/tape.qbs +++ b/src/app/tape/tape.qbs @@ -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 + } } diff --git a/src/app/valentina/valentina.qbs b/src/app/valentina/valentina.qbs index bf40a41ee..17949b39f 100644 --- a/src/app/valentina/valentina.qbs +++ b/src/app/valentina/valentina.qbs @@ -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 diff --git a/src/libs/qmuparser/qmuparser.qbs b/src/libs/qmuparser/qmuparser.qbs index e3a785d95..ee22fb7f9 100644 --- a/src/libs/qmuparser/qmuparser.qbs +++ b/src/libs/qmuparser/qmuparser.qbs @@ -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 + } } diff --git a/src/libs/vpropertyexplorer/vpropertyexplorer.qbs b/src/libs/vpropertyexplorer/vpropertyexplorer.qbs index a67203c65..b1f2202a7 100644 --- a/src/libs/vpropertyexplorer/vpropertyexplorer.qbs +++ b/src/libs/vpropertyexplorer/vpropertyexplorer.qbs @@ -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/"