|
| 1 | +From 843909f0215fa0ef0a6b41db380d3aae09b25b7f Mon Sep 17 00:00:00 2001 |
| 2 | +From: Shyamnath Premnadh < [email protected]> |
| 3 | +Date: Thu, 25 Jul 2024 15:21:51 +0200 |
| 4 | +Subject: [PATCH 1/3] PySide Build: Fix SHIBOKEN_DEBUG_LEVEL environment |
| 5 | + variable setting |
| 6 | + |
| 7 | +- checking if the environment variable was set used the wrong CMake |
| 8 | + syntax |
| 9 | + |
| 10 | +Pick-to: 6.7 |
| 11 | +Change-Id: Ib186a8ed10e66c074c22c24a43bf5a3b67cc9ffc |
| 12 | +Reviewed-by: Alexandru Croitor < [email protected]> |
| 13 | +--- |
| 14 | + sources/shiboken6/cmake/ShibokenHelpers.cmake | 2 +- |
| 15 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 16 | + |
| 17 | +diff --git a/sources/shiboken6/cmake/ShibokenHelpers.cmake b/sources/shiboken6/cmake/ShibokenHelpers.cmake |
| 18 | +index cff6df95e..27ee33305 100644 |
| 19 | +--- a/sources/shiboken6/cmake/ShibokenHelpers.cmake |
| 20 | ++++ b/sources/shiboken6/cmake/ShibokenHelpers.cmake |
| 21 | +@@ -882,7 +882,7 @@ function(shiboken_get_debug_level out_var) |
| 22 | + set(debug_level "") |
| 23 | + if(SHIBOKEN_DEBUG_LEVEL) |
| 24 | + set(debug_level "--debug-level=${SHIBOKEN_DEBUG_LEVEL}") |
| 25 | +- elseif(DEFINED $ENV{SHIBOKEN_DEBUG_LEVEL}) |
| 26 | ++ elseif(DEFINED ENV{SHIBOKEN_DEBUG_LEVEL}) |
| 27 | + set(debug_level "--debug-level=$ENV{SHIBOKEN_DEBUG_LEVEL}") |
| 28 | + endif() |
| 29 | + set(${out_var} "${debug_level}" PARENT_SCOPE) |
| 30 | +-- |
| 31 | +2.34.1 |
| 32 | + |
| 33 | +From b9dad02a19a084c00fed88600cd67f3cff614bb2 Mon Sep 17 00:00:00 2001 |
| 34 | +From: Shyamnath Premnadh < [email protected]> |
| 35 | +Date: Fri, 26 Jul 2024 10:50:53 +0200 |
| 36 | +Subject: [PATCH 2/3] PySide Build: Add an option to provide extra include |
| 37 | + paths for Shiboken |
| 38 | + |
| 39 | +- Expands on 7cc5c139482d735c49002649d26bb524c92cc86b, by creating a |
| 40 | + build option '--shiboken-extra-include-paths' that appends extra |
| 41 | + include paths to the '--force-process-system-include-paths' option |
| 42 | + when calling shiboken generator to create PySide6 modules. |
| 43 | +- This can be helpful for Flatpak and OS Distro builds of PySide6. |
| 44 | + |
| 45 | +Pick-to: 6.7 |
| 46 | +Change-Id: Ibd4c9702a741d8047ccaf53d84a1c97550d78ffe |
| 47 | +--- |
| 48 | + build_scripts/main.py | 5 +++++ |
| 49 | + build_scripts/options.py | 8 +++++++- |
| 50 | + sources/pyside6/cmake/PySideHelpers.cmake | 12 +++++++++++- |
| 51 | + 3 files changed, 23 insertions(+), 2 deletions(-) |
| 52 | + |
| 53 | +diff --git a/build_scripts/main.py b/build_scripts/main.py |
| 54 | +index 506a9891f..da132f0e0 100644 |
| 55 | +--- a/build_scripts/main.py |
| 56 | ++++ b/build_scripts/main.py |
| 57 | +@@ -613,6 +613,11 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): |
| 58 | + cmake_cmd.append("-DPYSIDE_TREAT_QT_INCLUDE_DIRS_AS_NON_SYSTEM=ON") |
| 59 | + log.info("Shiboken will now process system Qt headers") |
| 60 | + |
| 61 | ++ if OPTION['SHIBOKEN_EXTRA_INCLUDE_PATHS']: |
| 62 | ++ extra_include_paths = ';'.join(OPTION['SHIBOKEN_EXTRA_INCLUDE_PATHS'].split(',')) |
| 63 | ++ cmake_cmd.append(f"-DSHIBOKEN_FORCE_PROCESS_SYSTEM_INCLUDE_PATHS={extra_include_paths}") |
| 64 | ++ log.info(f"Shiboken will now process system headers from: {extra_include_paths}") |
| 65 | ++ |
| 66 | + cmake_cmd += [ |
| 67 | + "-G", self.make_generator, |
| 68 | + f"-DBUILD_TESTS={self.build_tests}", |
| 69 | +diff --git a/build_scripts/options.py b/build_scripts/options.py |
| 70 | +index 731ac8087..3442d2667 100644 |
| 71 | +--- a/build_scripts/options.py |
| 72 | ++++ b/build_scripts/options.py |
| 73 | +@@ -254,7 +254,11 @@ class CommandMixin(object): |
| 74 | + # This option is specific for Flatpak and OS distro builds of PySide6. So, use with |
| 75 | + # caution as it may also try to parse other global headers. |
| 76 | + ('shiboken-force-process-system-headers', None, |
| 77 | +- 'When building PySide against system Qt, shiboken does not ignore the system Qt headers') |
| 78 | ++ 'When building PySide against system Qt, shiboken does not ignore the system Qt headers'), |
| 79 | ++ # shiboken-extra-inlude-paths option is specifically used to tell the clang inside shiboken |
| 80 | ++ # to include extra paths when parsing the headers. Use with caution. |
| 81 | ++ ('shiboken-extra-include-paths=', None, |
| 82 | ++ 'Extra include paths for shiboken. Comma separated.'), |
| 83 | + ] |
| 84 | + |
| 85 | + def __init__(self): |
| 86 | +@@ -317,6 +321,7 @@ class CommandMixin(object): |
| 87 | + self.no_unity = False |
| 88 | + self.unity_build_batch_size = "16" |
| 89 | + self.shiboken_force_process_system_headers = False |
| 90 | ++ self.shiboken_extra_include_paths = None |
| 91 | + |
| 92 | + # When initializing a command other than the main one (so the |
| 93 | + # first one), we need to copy the user options from the main |
| 94 | +@@ -438,6 +443,7 @@ class CommandMixin(object): |
| 95 | + OPTION['UNITY'] = not self.no_unity |
| 96 | + OPTION['UNITY_BUILD_BATCH_SIZE'] = self.unity_build_batch_size |
| 97 | + OPTION['SHIBOKEN_FORCE_PROCESS_SYSTEM_HEADERS'] = self.shiboken_force_process_system_headers |
| 98 | ++ OPTION['SHIBOKEN_EXTRA_INCLUDE_PATHS'] = self.shiboken_extra_include_paths |
| 99 | + |
| 100 | + qtpaths_abs_path = None |
| 101 | + if self.qtpaths and Path(self.qtpaths).exists(): |
| 102 | +diff --git a/sources/pyside6/cmake/PySideHelpers.cmake b/sources/pyside6/cmake/PySideHelpers.cmake |
| 103 | +index 01c438107..48502f384 100644 |
| 104 | +--- a/sources/pyside6/cmake/PySideHelpers.cmake |
| 105 | ++++ b/sources/pyside6/cmake/PySideHelpers.cmake |
| 106 | +@@ -236,7 +236,17 @@ macro(collect_module_if_found shortname) |
| 107 | + # If the module was found, and also the module path is the same as the |
| 108 | + # Qt5Core base path, we will generate the list with the modules to be installed |
| 109 | + set(looked_in_message ". Looked in: ${${_name_dir}}") |
| 110 | +- if("${${_name_found}}" AND (("${found_basepath}" GREATER "0") OR ("${found_basepath}" EQUAL "0"))) |
| 111 | ++ |
| 112 | ++ # 'found_basepath' is used to ensure consistency that all the modules are from the same Qt |
| 113 | ++ # directory which prevents issues from arising due to mixing versions or using incompatible Qt |
| 114 | ++ # modules. When SHIBOKEN_FORCE_PROCESS_SYSTEM_INCLUDE_PATHS is not empty, we can ignore this |
| 115 | ++ # requirement of 'found_basepath'. |
| 116 | ++ # This is specifically useful for Flatpak build of PySide6 where For Flatpak the modules are in |
| 117 | ++ # different directories. For Flatpak, although the modules are in different directories, they |
| 118 | ++ # are all compatible. |
| 119 | ++ if("${${_name_found}}" AND |
| 120 | ++ ((("${found_basepath}" GREATER "0") OR ("${found_basepath}" EQUAL "0")) OR |
| 121 | ++ (NOT SHIBOKEN_FORCE_PROCESS_SYSTEM_INCLUDE_PATHS STREQUAL ""))) |
| 122 | + message(STATUS "${module_state} module ${name} found (${ARGN})${looked_in_message}") |
| 123 | + # record the shortnames for the tests |
| 124 | + list(APPEND all_module_shortnames ${shortname}) |
| 125 | +-- |
| 126 | +2.34.1 |
| 127 | + |
| 128 | +From e6aabc488976156122e6a4d073b10111775a127f Mon Sep 17 00:00:00 2001 |
| 129 | +From: Shyamnath Premnadh < [email protected]> |
| 130 | +Date: Fri, 26 Jul 2024 11:04:20 +0200 |
| 131 | +Subject: [PATCH 3/3] PySide Build: Add --flatpak option |
| 132 | + |
| 133 | +- The new option is to enable a flatpak build of Qt for Python. This |
| 134 | + does the following things: |
| 135 | + 1. It turns the option --shiboken_force_process_system_headers ON |
| 136 | + by default. |
| 137 | + 2, It adds the include path '/app/include' to the option |
| 138 | + --shiboken_extra_include_paths. |
| 139 | + The problem with the KDE Flatpak SDK is that certain modules: |
| 140 | + QtPdf, QtPdfWidgets, QtWebEngineCore, QtWebEngineQuick, |
| 141 | + QtWebEngineWidgets, are not available and hences the headers |
| 142 | + are not present in '/usr/include'. Therefore we use the Flatpak |
| 143 | + WebEngine BaseApp as the base app for our Flatpak PySide6 BaseApp. |
| 144 | + This has the headers for the missing modules, but in '/app/include' |
| 145 | + instead of '/usr/include'. |
| 146 | + This patch passes '/app/include' as an additional include path |
| 147 | + to shiboken when building the Python bindings for the above |
| 148 | + mentioned missing modules. |
| 149 | + |
| 150 | +Pick-to: 6.7 |
| 151 | +Change-Id: I4e393007040c9d07dca1878027c224b63e3be5d7 |
| 152 | +--- |
| 153 | + build_scripts/options.py | 14 ++++++++++++++ |
| 154 | + 1 file changed, 14 insertions(+) |
| 155 | + |
| 156 | +diff --git a/build_scripts/options.py b/build_scripts/options.py |
| 157 | +index 3442d2667..922df2486 100644 |
| 158 | +--- a/build_scripts/options.py |
| 159 | ++++ b/build_scripts/options.py |
| 160 | +@@ -259,6 +259,15 @@ class CommandMixin(object): |
| 161 | + # to include extra paths when parsing the headers. Use with caution. |
| 162 | + ('shiboken-extra-include-paths=', None, |
| 163 | + 'Extra include paths for shiboken. Comma separated.'), |
| 164 | ++ # flatpak option is used to build PySide6 for Flatpak. Flatpak is a special case where |
| 165 | ++ # some of the headers for the Qt modules are located as system headers in /usr/include in |
| 166 | ++ # the KDE flatpak SDK. Therefore --shiboken-force-process-system headers will be by |
| 167 | ++ # default enabled when --flatpak is enabled. |
| 168 | ++ # Apart from that, headers for certain Qt modules like QtWebEngine, QtPdf etc. are located |
| 169 | ++ # in /app/include from the Flapak WebEngine baseapp. Therefore when the --flatpak option is |
| 170 | ++ # enabled, the extra include path of /app/include will be added to the option |
| 171 | ++ # --shiboken-extra-include-paths. |
| 172 | ++ ('flatpak', None, 'Build PySide6 for Flatpak.'), |
| 173 | + ] |
| 174 | + |
| 175 | + def __init__(self): |
| 176 | +@@ -322,6 +331,7 @@ class CommandMixin(object): |
| 177 | + self.unity_build_batch_size = "16" |
| 178 | + self.shiboken_force_process_system_headers = False |
| 179 | + self.shiboken_extra_include_paths = None |
| 180 | ++ self.flatpak = False |
| 181 | + |
| 182 | + # When initializing a command other than the main one (so the |
| 183 | + # first one), we need to copy the user options from the main |
| 184 | +@@ -444,6 +454,10 @@ class CommandMixin(object): |
| 185 | + OPTION['UNITY_BUILD_BATCH_SIZE'] = self.unity_build_batch_size |
| 186 | + OPTION['SHIBOKEN_FORCE_PROCESS_SYSTEM_HEADERS'] = self.shiboken_force_process_system_headers |
| 187 | + OPTION['SHIBOKEN_EXTRA_INCLUDE_PATHS'] = self.shiboken_extra_include_paths |
| 188 | ++ OPTION['FLATPAK'] = self.flatpak |
| 189 | ++ if OPTION['FLATPAK']: |
| 190 | ++ OPTION['SHIBOKEN_FORCE_PROCESS_SYSTEM_HEADERS'] = True |
| 191 | ++ OPTION['SHIBOKEN_EXTRA_INCLUDE_PATHS'] = '/app/include' |
| 192 | + |
| 193 | + qtpaths_abs_path = None |
| 194 | + if self.qtpaths and Path(self.qtpaths).exists(): |
| 195 | +-- |
| 196 | +2.34.1 |
| 197 | + |
0 commit comments