[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Component Plugin for anyone building Qt-5.15 on macOS
From: Patrick Stinson <patrickkidd () gmail ! com>
Date: 2022-10-17 17:27:34
Message-ID: CADb17j2QpEnqc3U5Pr_LN9YTf61kPhJStRVO1V5b=Ox=t_bb3A () mail ! gmail ! com
[Download RAW message or body]
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
[Attachment #3 (text/html)]
<div dir="ltr">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:<div><br></div><div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier \
New",monospace;font-size:12px;line-height:18px;white-space:pre"><div><span \
style="color:rgb(197,134,192)">import</span> os.path</div><div><span \
style="color:rgb(197,134,192)">from</span> pyqtdeploy.sysroot.plugins.Qt <span \
style="color:rgb(197,134,192)">import</span> QtComponent</div><br><div><span \
style="color:rgb(86,156,214)">class</span> <span \
style="color:rgb(78,201,176)">DemoQtComponent</span>(<span \
style="color:rgb(78,201,176)">QtComponent</span>):</div><br><div> <span \
style="color:rgb(86,156,214)">def</span> <span \
style="color:rgb(220,220,170)">unpack_archive</span>(<span \
style="color:rgb(156,220,254)">self</span>, <span \
style="color:rgb(156,220,254)">archive</span>, <span \
style="color:rgb(156,220,254)">chdir</span>=<span \
style="color:rgb(86,156,214)">True</span>):</div><div> <span \
style="color:rgb(206,145,120)">""" Override to patch 5.15+ on \
macos</span></div><div><span style="color:rgb(206,145,120)"> \
"""</span></div><div> archive_root = <span \
style="color:rgb(78,201,176)">super</span>().unpack_archive(archive, chdir)</div><br><div> \
<span style="color:rgb(106,153,85)"># Patch Qt-5.15+ on macOS.</span></div><br><div> \
<span style="color:rgb(197,134,192)">if</span> <span \
style="color:rgb(86,156,214)">self</span>.target_platform_name == <span \
style="color:rgb(206,145,120)">'macos'</span>:</div><div> <span \
style="color:rgb(86,156,214)">self</span>.patch_file(</div><div> <span \
style="color:rgb(206,145,120)">'qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h'</span>,</div><div> \
<span style="color:rgb(86,156,214)">self</span>._patch_qiosurfacegraphicsbuffer</div><div> \
)</div><br><div> <span style="color:rgb(197,134,192)">return</span> \
archive_root</div><br><div> <span style="color:rgb(220,220,170)">@</span><span \
style="color:rgb(78,201,176)">staticmethod</span></div><div> <span \
style="color:rgb(86,156,214)">def</span> <span \
style="color:rgb(220,220,170)">_patch_qiosurfacegraphicsbuffer</span>(<span \
style="color:rgb(156,220,254)">line</span>, <span \
style="color:rgb(156,220,254)">patch_file</span>):</div><div> <span \
style="color:rgb(206,145,120)">""" Qt-5.15 does not build on at least macOS \
Monterey.</span></div><div><span style="color:rgb(206,145,120)"> \
"""</span></div><br><div> patch_file.write(</div><div> \
line.replace(</div><div> <span style="color:rgb(206,145,120)">'#include \
<qpa/qplatformgraphicsbuffer.h>'</span>,</div><div> <span \
style="color:rgb(206,145,120)">'#include <CoreGraphics/CoreGraphics.h></span><span \
style="color:rgb(215,186,125)">\n</span><span style="color:rgb(206,145,120)">#include \
<qpa/qplatformgraphicsbuffer.h>'</span></div><div> )</div><div> \
)</div><br></div><br \
class="gmail-Apple-interchange-newline"></div><div><br></div><div><br></div><div>Cheers,</div><div>-Patrick</div></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic