Component Plugin for anyone building Qt-5.15 on macOS
Patrick Stinson
patrickkidd at gmail.com
Mon Oct 17 18:27:34 BST 2022
In case anyone needs it, here is a pyqtdeploy component plugin for Qt that
patches qtgui to build on macos. At least Monterey, not sure about others.
Looks like none of the 5.15 sources will build without this:
import os.path
from pyqtdeploy.sysroot.plugins.Qt import QtComponent
class DemoQtComponent(QtComponent):
def unpack_archive(self, archive, chdir=True):
""" Override to patch 5.15+ on macos
"""
archive_root = super().unpack_archive(archive, chdir)
# Patch Qt-5.15+ on macOS.
if self.target_platform_name == 'macos':
self.patch_file(
'qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h',
self._patch_qiosurfacegraphicsbuffer
)
return archive_root
@staticmethod
def _patch_qiosurfacegraphicsbuffer(line, patch_file):
""" Qt-5.15 does not build on at least macOS Monterey.
"""
patch_file.write(
line.replace(
'#include <qpa/qplatformgraphicsbuffer.h>',
'#include <CoreGraphics/CoreGraphics.h>\n#include
<qpa/qplatformgraphicsbuffer.h>'
)
)
Cheers,
-Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20221017/c134c844/attachment.htm>
More information about the PyQt
mailing list