1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Build with pyside6.

This commit is contained in:
Tiernan Hubble 2023-04-10 18:41:22 -06:00 committed by Juraj Oravec
parent d10379268b
commit 73554c230b
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
4 changed files with 22 additions and 4 deletions

View File

@ -154,11 +154,13 @@ if (BUILD_PYTHON_SUPPORT)
# Optional: PySide6 # Optional: PySide6
find_package(PySide6 "6.4.0") find_package(PySide6 "6.4.0")
find_package(Shiboken6 "6.4.0") find_package(Shiboken6 "6.4.0")
find_package(Shiboken6Tools "6.4.0")
find_package(Python3 COMPONENTS Development) find_package(Python3 COMPONENTS Development)
set_package_properties(PySide6 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL) set_package_properties(PySide6 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(Shiboken6 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL) set_package_properties(Shiboken6 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(Shiboken6Tools PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(Python3 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL) set_package_properties(Python3 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
if (PySide6_FOUND AND Shiboken6_FOUND AND Python3_FOUND) if (PySide6_FOUND AND Shiboken6_FOUND AND Shiboken6Tools_FOUND AND Python3_FOUND)
set(ENABLE_PYTHON_PLUGINS TRUE) set(ENABLE_PYTHON_PLUGINS TRUE)
endif() endif()
else() else()

View File

@ -20,6 +20,10 @@ set(QT_INCLUDE_DIRS
${QT_WEBENGINECORE_INCLUDE_DIRS} ${QT_WEBENGINECORE_INCLUDE_DIRS}
${QT_WEBENGINEWIDGETS_INCLUDE_DIRS} ${QT_WEBENGINEWIDGETS_INCLUDE_DIRS}
) )
if (QT_MAJOR_VERSION STREQUAL "6")
get_property(QT_PRINTSUPPORT_INCLUDE_DIRS TARGET Qt${QT_MAJOR_VERSION}::PrintSupport PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
list(APPEND QT_INCLUDE_DIRS ${QT_PRINTSUPPORT_INCLUDE_DIRS})
endif()
set(INCLUDES "") set(INCLUDES "")
foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS}) foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS})
list(APPEND INCLUDES "-I${INCLUDE_DIR}") list(APPEND INCLUDES "-I${INCLUDE_DIR}")
@ -33,13 +37,19 @@ endforeach()
set(GLOBAL_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/pyfalkon_global.h) set(GLOBAL_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/pyfalkon_global.h)
set(TYPESYSTEM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pyfalkon.xml) set(TYPESYSTEM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pyfalkon.xml)
if (QT_MAJOR_VERSION STREQUAL "6")
set(API_VERSION "${Qt6_VERSION_MAJOR}.${Qt6_VERSION_MINOR}")
else()
set(API_VERSION "${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR}")
endif()
set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic
--enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero
--avoid-protected-hack --avoid-protected-hack
${INCLUDES} ${INCLUDES}
-T${PYSIDE_TYPESYSTEMS} -T${PYSIDE_TYPESYSTEMS}
--output-directory=${CMAKE_CURRENT_BINARY_DIR} --output-directory=${CMAKE_CURRENT_BINARY_DIR}
--api-version="${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR}" --api-version="${API_VERSION}"
) )
# Specify which sources will be generated by shiboken, and their dependencies. # Specify which sources will be generated by shiboken, and their dependencies.

View File

@ -21,7 +21,11 @@
// PYSIDE-711 // PYSIDE-711
#include <QHstsPolicy> #include <QHstsPolicy>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QWebEngineContextMenuData> #include <QWebEngineContextMenuData>
#else
#include <QWebEngineContextMenuRequest>
#endif
// 3rdparty // 3rdparty
#include "lineedit.h" #include "lineedit.h"

View File

@ -125,7 +125,9 @@
</object-type> </object-type>
<object-type name="NavigationBar"/> <object-type name="NavigationBar"/>
<object-type name="NetworkManager"/> <object-type name="NetworkManager">
<modify-function signature="certificateError(QWebEngineCertificateError&amp;, QWidget*)" remove="all"/>
</object-type>
<object-type name="UrlInterceptor"/> <object-type name="UrlInterceptor"/>
<object-type name="ExtensionSchemeHandler"> <object-type name="ExtensionSchemeHandler">
<include file-name="schemehandlers/extensionschemehandler.h" location="global"/> <include file-name="schemehandlers/extensionschemehandler.h" location="global"/>
@ -256,7 +258,7 @@
QList&lt;QByteArray&gt; version = QByteArray(Qz::VERSION).split('.'); QList&lt;QByteArray&gt; version = QByteArray(Qz::VERSION).split('.');
PyObject *pyFalkonVersion = PyTuple_New(3); PyObject *pyFalkonVersion = PyTuple_New(3);
for (int i = 0; i &lt; 3; ++i) for (int i = 0; i &lt; 3; ++i)
PyTuple_SET_ITEM(pyFalkonVersion, i, PyInt_FromLong(version[i].toInt())); PyTuple_SET_ITEM(pyFalkonVersion, i, PyLong_FromLong(version[i].toInt()));
PyModule_AddObject(module, "__version_info__", pyFalkonVersion); PyModule_AddObject(module, "__version_info__", pyFalkonVersion);
PyModule_AddStringConstant(module, "__version__", Qz::VERSION); PyModule_AddStringConstant(module, "__version__", Qz::VERSION);
</inject-code> </inject-code>