From 1bca74b41ac0a4fc1e5d59df4e591cb39b615c73 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Mon, 13 Sep 2021 12:26:00 +0300 Subject: [PATCH] Add QML Script Compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QML Script Compiler is a commercial drop-in replacement for the cachegen tool to compile your QML script expressions and functions to C++ ahead of time. It is available only for commercial customers and source code fetch needs proper ssh keys available for accessing the repository at codereview.qt-project.org. Usage of QML Script Compiler is not enabled by default, but if enabled globally using ENABLE_QMLCOMPILER variable, all Qt modules that have dependency to qtdeclarative are compiled using Qt QML Compiler. Its usage can also be enabled or disabled by each individual recipe. Task-number: QTBUG-95475 Change-Id: Iee8539ee8ddc17c70e9ed81ab3b4f242f9386586 Reviewed-by: Ulf Hermann Reviewed-by: Pasi Petäjäjärvi (cherry picked from commit d0e7002304006fde9086974e15793837ae90a5c0) Reviewed-by: Samuli Piippo --- coin/test-configs.inc | 7 ++++++ ...tivesdk-packagegroup-qt6-toolchain-host.bb | 1 + .../packagegroups/packagegroup-qt6-addons.bb | 1 + recipes-qt/qt6/qmlcompilerplus_git.bb | 24 +++++++++++++++++++ recipes-qt/qt6/qt6-git.inc | 1 + recipes-qt/qt6/qt6.inc | 10 ++++++++ 6 files changed, 44 insertions(+) create mode 100644 recipes-qt/qt6/qmlcompilerplus_git.bb diff --git a/coin/test-configs.inc b/coin/test-configs.inc index e1dcdbb..3725ce3 100644 --- a/coin/test-configs.inc +++ b/coin/test-configs.inc @@ -12,6 +12,12 @@ DISTRO_FEATURES:append = " wayland" INHERIT += "buildstats buildstats-summary" INHERIT += "rm_work" +# default to commercial Qt +QT_EDITION = "commercial" + +# enable Qt QML Compiler +ENABLE_QMLCOMPILER = "1" + # fast compression of SDK tar package SDK_XZ_COMPRESSION_LEVEL = "-1" @@ -48,6 +54,7 @@ PACKAGECONFIG:append:pn-qtbase = "\ PACKAGECONFIG:append:pn-qtimageformats = " jasper" # enable examples for all Qt modules +PACKAGECONFIG:append:pn-qmlcompilerplus = " examples" PACKAGECONFIG:append:pn-qt3d = " examples" PACKAGECONFIG:append:pn-qt5compat = " examples" PACKAGECONFIG:append:pn-qtbase = " examples" diff --git a/recipes-qt/packagegroups/nativesdk-packagegroup-qt6-toolchain-host.bb b/recipes-qt/packagegroups/nativesdk-packagegroup-qt6-toolchain-host.bb index c3e169f..4687f4b 100644 --- a/recipes-qt/packagegroups/nativesdk-packagegroup-qt6-toolchain-host.bb +++ b/recipes-qt/packagegroups/nativesdk-packagegroup-qt6-toolchain-host.bb @@ -10,6 +10,7 @@ RDEPENDS:${PN} += " \ nativesdk-cmake \ nativesdk-ninja \ nativesdk-perl-modules \ + ${@bb.utils.contains('ENABLE_QMLCOMPILER', '1', 'nativesdk-qmlcompilerplus', '', d)} \ nativesdk-qtbase-dev \ nativesdk-qtbase-tools \ nativesdk-qtdeclarative-dev \ diff --git a/recipes-qt/packagegroups/packagegroup-qt6-addons.bb b/recipes-qt/packagegroups/packagegroup-qt6-addons.bb index 7b265b9..59b69cb 100644 --- a/recipes-qt/packagegroups/packagegroup-qt6-addons.bb +++ b/recipes-qt/packagegroups/packagegroup-qt6-addons.bb @@ -8,6 +8,7 @@ inherit packagegroup PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1" RDEPENDS:${PN} += " \ + ${@bb.utils.contains('ENABLE_QMLCOMPILER', '1', 'qmlcompilerplus', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'qt3d', '', d)} \ qt5compat \ qtcharts \ diff --git a/recipes-qt/qt6/qmlcompilerplus_git.bb b/recipes-qt/qt6/qmlcompilerplus_git.bb new file mode 100644 index 0000000..a329e2d --- /dev/null +++ b/recipes-qt/qt6/qmlcompilerplus_git.bb @@ -0,0 +1,24 @@ +LICENSE = "The-Qt-Company-Commercial" +LIC_FILES_CHKSUM = " \ + file://src/qmlcompilerplus/cppcodegen_p.h;endline=27;md5=6a1dccd03d0d5864357e72b67def8ff2 \ +" + +inherit qt6-cmake + +include recipes-qt/qt6/qt6-git.inc +include recipes-qt/qt6/qt6.inc + +python() { + if d.getVar('QT_EDITION') != 'commercial': + raise bb.parse.SkipRecipe('Available only with Commercial Qt') +} + +QT_GIT = "git://codereview.qt-project.org" +QT_GIT_PROTOCOL = "ssh" +QT_MODULE = "tqtc-qmlcompilerplus" + +DEPENDS += "qtbase qtdeclarative qtdeclarative-native" + +PTEST_ENABLED = "0" + +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-qt/qt6/qt6-git.inc b/recipes-qt/qt6/qt6-git.inc index 600d2f0..94815ad 100644 --- a/recipes-qt/qt6/qt6-git.inc +++ b/recipes-qt/qt6/qt6-git.inc @@ -15,6 +15,7 @@ PV = "6.2.2" SRCREV = "${SRCREV_${QT_MODULE}}" +SRCREV_tqtc-qmlcompilerplus = "c2b3bac7c992b7038c33c233d53bdb1cc8583c07" SRCREV_qt3d = "d548a2f8f7f4cdc560c9f48767cb67cffafc181b" SRCREV_qt3d-assimp = "5a38cd0a03015ceabbd5bc6efb0730dde1ef74e5" SRCREV_qt5compat = "9472f2cfe0abff5018f260c0084e6987629f4e92" diff --git a/recipes-qt/qt6/qt6.inc b/recipes-qt/qt6/qt6.inc index 9f0b25f..2c73aa6 100644 --- a/recipes-qt/qt6/qt6.inc +++ b/recipes-qt/qt6/qt6.inc @@ -21,6 +21,16 @@ python __anonymous() { d.setVar("PACKAGE_ARCH", tarch) } +python __anonymous() { + if (d.getVar('QT_EDITION', True) != 'commercial' or + d.getVar('ENABLE_QMLCOMPILER', True) == '0' or + d.getVar('BPN', True) == 'qmlcompilerplus' or + d.getVar('CLASSOVERRIDE', True) != 'class-target'): + return + if bb.utils.contains('DEPENDS', "qtdeclarative-native", True, False, d): + d.appendVar("DEPENDS", " qmlcompilerplus-native") +} + # Many examples come with libraries installed outside of standard libdir, # suppress QA check complaining INSANE_SKIP:${PN}-dbg += "libdir"