diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-03-06 10:55:12 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-03-06 14:15:23 +0000 |
commit | ab8c670a3690998c5d9424da9af18ca38df47078 (patch) | |
tree | c7d90ea1f23d37616431e5a19afaabf6c5063362 | |
parent | 90a0d19462a1f781382c355fda19969b54c27e73 (diff) |
Fix qtquickcompiler support for Qt >= 5.11
The functionality of qtquickcompiler is now in qmlcachegen.
Change-Id: I70c45f9db72895e2146cbf4bb7902b8db294626c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/lib/qtprofilesetup/templates/quick.qbs | 41 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs | 1 |
2 files changed, 28 insertions, 14 deletions
diff --git a/src/lib/qtprofilesetup/templates/quick.qbs b/src/lib/qtprofilesetup/templates/quick.qbs index 5b676d823..a6c842b8e 100644 --- a/src/lib/qtprofilesetup/templates/quick.qbs +++ b/src/lib/qtprofilesetup/templates/quick.qbs @@ -33,6 +33,7 @@ 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 @@ -62,10 +63,16 @@ QtModule { cpp.libraryPaths: @libraryPaths@ @special_properties@ + 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, - "qtquickcompiler" + product.cpp.executableSuffix) + compilerBaseName + product.cpp.executableSuffix) property bool compilerAvailable: File.exists(compilerFilePath); - property bool useCompiler: compilerAvailable + property bool useCompiler: compilerAvailable && !_compilerIsQmlCacheGen Scanner { condition: useCompiler @@ -132,7 +139,7 @@ QtModule { }); }); result.push({ - filePath: "qtquickcompiler_loader.cpp", + filePath: product.Qt.quick._generatedLoaderFileName, fileTags: ["cpp"] }); return result; @@ -147,6 +154,7 @@ QtModule { var cmds = []; var qmlCompiler = product.Qt.quick.compilerFilePath; + var useCacheGen = product.Qt.quick._compilerIsQmlCacheGen; var cmd; var loaderFlags = []; @@ -166,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; diff --git a/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs b/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs index 372ee069b..5f79df581 100644 --- a/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs +++ b/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs @@ -2,6 +2,7 @@ import qbs CppApplication { Depends { name: "Qt.quick" } + Qt.quick.useCompiler: Qt.quick.compilerAvailable cpp.cxxLanguageVersion: "c++11" |