gui-qml icon indicating copy to clipboard operation
gui-qml copied to clipboard

Enable Ahead-of-Time Compilation

Open promag opened this issue 3 years ago • 4 comments

Currently build works with invalid syntax, like

--- a/src/qml/controls/OptionButton.qml
+++ b/src/qml/controls/OptionButton.qml
@@ -65,7 +65,7 @@ Button {
                 rightPadding: 7
                 bottomPadding: 4
                 leftPadding: 7
-                color: "black"
+                co lor: "black"
                 text: qsTr("Recommended")
             }
         }

which gives a runtime error:

QQmlApplicationEngine failed to load component
qrc:/qml/pages/stub.qml:43:9: Type ConnectionOptions unavailable
qrc:/qml/components/ConnectionOptions.qml:15:5: Type OptionButton unavailable
qrc:/qml/controls/OptionButton.qml:68:20: Unexpected token `identifier'

Fix this by turning to build-time errors. It's unclear how to use it with Autotools though.

Reference: https://doc.qt.io/qt-5.15/qtquick-deployment.html#ahead-of-time-compilation https://doc.qt.io/archives/QtQuickCompiler/index.html

promag avatar Jan 05 '22 15:01 promag

https://doc.qt.io/qt-5.15/qtquick-deployment.html#ahead-of-time-compilation

hebasto avatar Jan 05 '22 16:01 hebasto

The following patch

--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -309,7 +309,7 @@ endef
 define $(package)_stage_cmds
   export PATH && \
   $(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \
-  $(MAKE) -C qtdeclarative INSTALL_ROOT=$($(package)_staging_dir) sub-src-install_subtargets && \
+  $(MAKE) -C qtdeclarative INSTALL_ROOT=$($(package)_staging_dir) install_subtargets && \
   $(MAKE) -C qtquickcontrols2 INSTALL_ROOT=$($(package)_staging_dir) sub-src-install_subtargets && \
   $(MAKE) -C qttools/src/linguist INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_linguist_tools))) && \
   $(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets

makes QML-specific tools available in our depends, in particular qmlcachegen and qmllint.

hebasto avatar Jan 05 '22 18:01 hebasto

--- a/src/qml/controls/OptionButton.qml
+++ b/src/qml/controls/OptionButton.qml
@@ -65,7 +65,7 @@ Button {
                 rightPadding: 7
                 bottomPadding: 4
                 leftPadding: 7
-                color: "black"
+                co lor: "black"
                 text: qsTr("Recommended")
             }
         }

A compile-time error:

$ /home/hebasto/GitHub/gui-qml/depends/x86_64-pc-linux-gnu/native/bin/qmlcachegen /home/hebasto/GitHub/gui-qml/src/qml/controls/OptionButton.qml
Error compiling qml file: /home/hebasto/GitHub/gui-qml/src/qml/controls/OptionButton.qml:68:20: error: Unexpected token `identifier'

hebasto avatar Jan 05 '22 18:01 hebasto

This will be free with a CMAKE build system

jarolrod avatar Aug 15 '22 19:08 jarolrod