You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initial support for PySide6 and Qt bootstrap (#2918)
* Initial support for PySide6
- Add a new bootstrap for Qt
- This bootstrap will be used by `pyside6-android-deploy` tool shipped
with PySide6, which interally calls pythonforandroid using buildozer.
- The Qt bootstrap depends on recipes PySide6 and shiboken6 among
other mandatory recipes. The recipes for PySide6 and shiboken6
resides in the PySide repository -
https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside-tools/deploy_lib/android/recipes
- The PythonActivity entrypoint class is derived from QtActivity class
which is the main acitivty class when a Qt C++ application is
packaged for Android. The jar containing QtActivity class is supplied
through buildozer `android.add_jars` option.
- The C wrapper binary to the application main.py is named as
`main_{abi_name}` instead of just `main` for other bootstraps.
- Multi architecture deployment is not supported at the moment.
- Adapt tests based on the new Qt bootstrap
* Add Qt boostrap to docs
- update the docs to include sections depicting the Qt boostrap.
* Tweak gradle build properties for Qt bootstrap
- Sometimes a flaky Java heap out of memory error is throw. By,
tweaking the memory setting we can get rid of that error.
* Fix bug - check for main.py
- Qt boostrap removed from comparison in the changed line because
its expects a value is args.launcher, which is not applicable for
Qt boostrap. Hence, it exits with an value not found exception.
- Removing Qt boostrap from the comparison leads to checking
for main.py or --private, which is to be done for the Qt boostrap.
* Make --init-classes truly optional
- check if empty, otherwise store empty string
* Add a non-gui test app build to CI that uses Qt bootstrap
- for the purpose of testing, the pyside6 and shiboken6 wheels, the
extra .jar files needed and the recipes for pyside6 and shiboken6
are manually added into testapps/on_device_unit_tests/test_qt.
These files are normally generated by the `pyside6-android-deploy`
tool that is shipped with PySide.
Generating the wheels and the .jar files belongs to the scope of
PySide and not python-for-android. Hence, they are not done here.
This also reduces the load on the CI which will otherwise have to
cross-compile CPython and PySide.
- The Android aarch64 wheels for testing are downloaded from Qt servers.
These wheels are for testing purposes only and the download link will
be updated when official PySide6 Android wheels are generated.
- Tests were added in test_requirements.py so that when running the apk
the current date and time are printed on the terminal. The tests also
checks shiboken6 and PySide6 module imports.
* Remove superfluous whitespace removal
- This was introduced by a VSCode setting and is unrealated to this
patch. Although this might be good, this has to be introduced through
a different patch.
- pyside6 recipe typo adapted in buildoptions.rst
* Add aab generation to test app with Qt bootstrap
* Fix typo in doc/source/buildoptions.rst
Co-authored-by: Mirko Galimberti <me@mirkogalimberti.com>
---------
Co-authored-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Co-authored-by: Mirko Galimberti <me@mirkogalimberti.com>
Copy file name to clipboardExpand all lines: doc/source/buildoptions.rst
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -204,6 +204,49 @@ systems and frameworks.
204
204
include multiple jar files, pass this argument multiple times.
205
205
- ``add-source``: Add a source directory to the app's Java code.
206
206
207
+
Qt
208
+
~~
209
+
210
+
This bootstrap can be used with ``--bootstrap=qt`` or by including the ``PySide6`` or
211
+
``shiboken6`` recipe, e.g. ``--requirements=pyside6,shiboken6``. Currently, the only way
212
+
to use this bootstrap is through `pyside6-android-deploy <https://www.qt.io/blog/taking-qt-for-python-to-android>`__
213
+
tool shipped with ``PySide6``, as the recipes for ``PySide6`` and ``shiboken6`` are created
214
+
dynamically. The tool builds ``PySide6`` and ``shiboken6`` wheels for a specific Android platform
215
+
and the recipes simply unpack the built wheels. You can see the recipes `here <https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside-tools/deploy_lib/android/recipes>`__.
216
+
217
+
.. note::
218
+
The ``pyside6-android-deploy`` tool and hence the Qt bootstrap does not support multi-architecture
219
+
builds currently.
220
+
221
+
What are Qt and PySide?
222
+
%%%%%%%%%%%%%%%%%%%%%%%%
223
+
224
+
`Qt <https://www.qt.io/>`__ is a popularly used cross-platform C++ framework for developing
225
+
GUI applications. `PySide6 <https://doc.qt.io/qtforpython-6/quickstart.html>`__ refers to the
226
+
Python bindings for Qt6, and enables the Python developers access to the Qt6 API.
227
+
`Shiboken6 <https://doc.qt.io/qtforpython-6/shiboken6/index.html>`__ is the binding generator
228
+
tool used for generating the Python bindings from C++ code.
229
+
230
+
.. note:: The `shiboken6` recipe is for the `Shiboken Python module <https://doc.qt.io/qtforpython-6/shiboken6/shibokenmodule.html>`__
231
+
which includes a couple of utility functions for inspecting and debugging PySide6 code.
232
+
233
+
Build Options
234
+
%%%%%%%%%%%%%
235
+
236
+
``pyside6-android-deploy`` works by generating a ``buildozer.spec`` file and thereby using
237
+
`buildozer <https://buildozer.readthedocs.io/en/latest/>`__ to control the build options used by
238
+
``python-for-android`` with the Qt bootstrap. Apart from the general build options that works
239
+
across all the other bootstraps, the Qt bootstrap introduces the following 3 new build options.
240
+
241
+
- ``--qt-libs``: list of Qt libraries(modules) to be loaded.
242
+
- ``--load-local-libs``: list of Qt plugin libraries to be loaded.
243
+
- ``--init-classes``: list of Java class names to the loaded from the Qt jar files supplied through
244
+
the ``--add-jar`` option.
245
+
246
+
These build options are automatically populated by the ``pyside6-android-deploy`` tool, but can be
247
+
modified by updating the ``buildozer.spec`` file. Apart from the above 3 build options, the tool
248
+
also automatically identifies the values to be fed into the cli options ``--permission``, ``--add-jar``
249
+
depending on the PySide6 modules used by the applicaiton.
0 commit comments