diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-03-09 10:15:40 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-03-09 10:15:40 +0100 |
commit | b608f25a930710dc146e9e4ed99104be36de1024 (patch) | |
tree | 07f4f767f09b731d1b166bbe39fff88e995b3936 /src/lib/qtprofilesetup | |
parent | e183c300f6daed0d000a2a70d46e9f001f97873f (diff) | |
parent | abfc4c1b37d18515c8da0678a665886d7cb69af5 (diff) |
Merge 1.11 into master
Change-Id: Ie416a83940654e21b8872a8c7dc9f56b677ebabd
Diffstat (limited to 'src/lib/qtprofilesetup')
-rw-r--r-- | src/lib/qtprofilesetup/qtenvironment.h | 1 | ||||
-rw-r--r-- | src/lib/qtprofilesetup/qtprofilesetup.cpp | 9 | ||||
-rw-r--r-- | src/lib/qtprofilesetup/templates/quick.qbs | 57 |
3 files changed, 38 insertions, 29 deletions
diff --git a/src/lib/qtprofilesetup/qtenvironment.h b/src/lib/qtprofilesetup/qtenvironment.h index 19b27871b..0b6ab8e51 100644 --- a/src/lib/qtprofilesetup/qtenvironment.h +++ b/src/lib/qtprofilesetup/qtenvironment.h @@ -81,7 +81,6 @@ public: Version msvcVersion; bool staticBuild = false; bool frameworkBuild = false; - bool hasQtQuickCompiler = false; }; } // namespace qbs diff --git a/src/lib/qtprofilesetup/qtprofilesetup.cpp b/src/lib/qtprofilesetup/qtprofilesetup.cpp index 66f6afd83..e78b8a252 100644 --- a/src/lib/qtprofilesetup/qtprofilesetup.cpp +++ b/src/lib/qtprofilesetup/qtprofilesetup.cpp @@ -495,11 +495,6 @@ static void replaceSpecialValues(QByteArray *content, const Profile &profile, s << indent << "property string qmlImportsPath: " << pathToJSLiteral(qtEnvironment.qmlImportPath); - if (module.qbsName == QLatin1String("quick")) { - s << endl << indent << "property bool compilerAvailable: " - << toJSLiteral(qtEnvironment.hasQtQuickCompiler); - } - const QByteArray baIndent(4, ' '); compilerDefines = "{\n" + baIndent + baIndent + "var result = " + compilerDefines + ";\n" @@ -811,10 +806,6 @@ void doSetupQtProfile(const QString &profileName, Settings *settings, Profile profile(profileName, settings); profile.removeProfile(); - if (QFileInfo::exists(qtEnvironment.mkspecBasePath - + QStringLiteral("/features/qtquickcompiler.prf"))) { - qtEnvironment.hasQtQuickCompiler = true; - } createModules(profile, settings, qtEnvironment); } diff --git a/src/lib/qtprofilesetup/templates/quick.qbs b/src/lib/qtprofilesetup/templates/quick.qbs index b61806836..745f29cc2 100644 --- a/src/lib/qtprofilesetup/templates/quick.qbs +++ b/src/lib/qtprofilesetup/templates/quick.qbs @@ -29,9 +29,11 @@ ****************************************************************************/ import qbs -import qbs.Process +import qbs.File import qbs.FileInfo +import qbs.Process import qbs.TextFile +import qbs.Utilities import '../QtModule.qbs' as QtModule import 'quick.js' as QC @@ -60,22 +62,34 @@ QtModule { cpp.includePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ + + readonly property bool _compilerIsQmlCacheGen: Utilities.versionCompare(Qt.core.version, + "5.11") >= 0 + readonly property string _generatedLoaderFileName: _compilerIsQmlCacheGen + ? "qmlcache_loader.cpp" + : "qtquickcompiler_loader.cpp" + property string compilerBaseName: (_compilerIsQmlCacheGen ? "qmlcachegen" : "qtquickcompiler") + property string compilerFilePath: FileInfo.joinPaths(Qt.core.binPath, + compilerBaseName + product.cpp.executableSuffix) + property bool compilerAvailable: File.exists(compilerFilePath); + property bool useCompiler: compilerAvailable && !_compilerIsQmlCacheGen + Scanner { - condition: compilerAvailable + condition: useCompiler inputs: 'qt.quick.qrc' searchPaths: [FileInfo.path(input.filePath)] scan: QC.scanQrc(input.filePath) } FileTagger { - condition: compilerAvailable + condition: useCompiler patterns: "*.qrc" fileTags: ["qt.quick.qrc"] priority: 100 } Rule { - condition: compilerAvailable + condition: useCompiler inputs: ["qt.quick.qrc"] Artifact { filePath: input.fileName + ".json" @@ -97,7 +111,7 @@ QtModule { } Rule { - condition: compilerAvailable + condition: useCompiler inputs: ["qt.quick.qrcinfo"] outputFileTags: ["cpp", "qrc"] multiplex: true @@ -125,7 +139,7 @@ QtModule { }); }); result.push({ - filePath: "qtquickcompiler_loader.cpp", + filePath: product.Qt.quick._generatedLoaderFileName, fileTags: ["cpp"] }); return result; @@ -139,8 +153,8 @@ QtModule { }); var cmds = []; - var qmlCompiler = FileInfo.joinPaths(product.Qt.core.binPath, - "qtquickcompiler" + product.cpp.executableSuffix); + var qmlCompiler = product.Qt.quick.compilerFilePath; + var useCacheGen = product.Qt.quick._compilerIsQmlCacheGen; var cmd; var loaderFlags = []; @@ -160,29 +174,34 @@ QtModule { loaderFlags.push("--resource-file-mapping=" + FileInfo.fileName(info.qrcFilePath) + ":" + info.newQrcFileName); - cmd = new Command(qmlCompiler, ["--filter-resource-file", - info.qrcFilePath, - findOutput(info.newQrcFileName).filePath]); + var args = ["--filter-resource-file", + info.qrcFilePath]; + if (useCacheGen) + args.push("-o"); + args.push(findOutput(info.newQrcFileName).filePath); + cmd = new Command(qmlCompiler, args); cmd.description = "generating " + info.newQrcFileName; cmds.push(cmd); } else { loaderFlags.push("--resource-file-mapping=" + info.qrcFilePath); } info.qmlJsFiles.forEach(function (qmlJsFile) { - cmd = new Command(qmlCompiler, [ - "--resource=" + info.qrcFilePath, - qmlJsFile.input, - findOutput(qmlJsFile.output).filePath]); + var args = ["--resource=" + info.qrcFilePath, qmlJsFile.input]; + if (useCacheGen) + args.push("-o"); + args.push(findOutput(qmlJsFile.output).filePath); + cmd = new Command(qmlCompiler, args); cmd.description = "generating " + qmlJsFile.output; cmd.workingDirectory = FileInfo.path(info.qrcFilePath); cmds.push(cmd); }); }); - cmd = new Command(qmlCompiler, loaderFlags.concat( - infos.map(function (info) { return info.qrcFilePath; }), - findOutput("qtquickcompiler_loader.cpp").filePath - )); + var args = loaderFlags.concat(infos.map(function (info) { return info.qrcFilePath; })); + if (useCacheGen) + args.push("-o"); + args.push(findOutput(product.Qt.quick._generatedLoaderFileName).filePath); + cmd = new Command(qmlCompiler, args); cmd.description = "generating loader source"; cmds.push(cmd); return cmds; |