diff options
| -rw-r--r-- | build_scripts/main.py | 5 | ||||
| -rw-r--r-- | build_scripts/options.py | 8 | ||||
| -rw-r--r-- | sources/pyside6/cmake/PySideHelpers.cmake | 12 |
3 files changed, 23 insertions, 2 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index 506a9891f..da132f0e0 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -613,6 +613,11 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): cmake_cmd.append("-DPYSIDE_TREAT_QT_INCLUDE_DIRS_AS_NON_SYSTEM=ON") log.info("Shiboken will now process system Qt headers") + if OPTION['SHIBOKEN_EXTRA_INCLUDE_PATHS']: + extra_include_paths = ';'.join(OPTION['SHIBOKEN_EXTRA_INCLUDE_PATHS'].split(',')) + cmake_cmd.append(f"-DSHIBOKEN_FORCE_PROCESS_SYSTEM_INCLUDE_PATHS={extra_include_paths}") + log.info(f"Shiboken will now process system headers from: {extra_include_paths}") + cmake_cmd += [ "-G", self.make_generator, f"-DBUILD_TESTS={self.build_tests}", diff --git a/build_scripts/options.py b/build_scripts/options.py index 731ac8087..3442d2667 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -254,7 +254,11 @@ class CommandMixin(object): # This option is specific for Flatpak and OS distro builds of PySide6. So, use with # caution as it may also try to parse other global headers. ('shiboken-force-process-system-headers', None, - 'When building PySide against system Qt, shiboken does not ignore the system Qt headers') + 'When building PySide against system Qt, shiboken does not ignore the system Qt headers'), + # shiboken-extra-inlude-paths option is specifically used to tell the clang inside shiboken + # to include extra paths when parsing the headers. Use with caution. + ('shiboken-extra-include-paths=', None, + 'Extra include paths for shiboken. Comma separated.'), ] def __init__(self): @@ -317,6 +321,7 @@ class CommandMixin(object): self.no_unity = False self.unity_build_batch_size = "16" self.shiboken_force_process_system_headers = False + self.shiboken_extra_include_paths = None # When initializing a command other than the main one (so the # first one), we need to copy the user options from the main @@ -438,6 +443,7 @@ class CommandMixin(object): OPTION['UNITY'] = not self.no_unity OPTION['UNITY_BUILD_BATCH_SIZE'] = self.unity_build_batch_size OPTION['SHIBOKEN_FORCE_PROCESS_SYSTEM_HEADERS'] = self.shiboken_force_process_system_headers + OPTION['SHIBOKEN_EXTRA_INCLUDE_PATHS'] = self.shiboken_extra_include_paths qtpaths_abs_path = None if self.qtpaths and Path(self.qtpaths).exists(): diff --git a/sources/pyside6/cmake/PySideHelpers.cmake b/sources/pyside6/cmake/PySideHelpers.cmake index 01c438107..48502f384 100644 --- a/sources/pyside6/cmake/PySideHelpers.cmake +++ b/sources/pyside6/cmake/PySideHelpers.cmake @@ -236,7 +236,17 @@ macro(collect_module_if_found shortname) # If the module was found, and also the module path is the same as the # Qt5Core base path, we will generate the list with the modules to be installed set(looked_in_message ". Looked in: ${${_name_dir}}") - if("${${_name_found}}" AND (("${found_basepath}" GREATER "0") OR ("${found_basepath}" EQUAL "0"))) + + # 'found_basepath' is used to ensure consistency that all the modules are from the same Qt + # directory which prevents issues from arising due to mixing versions or using incompatible Qt + # modules. When SHIBOKEN_FORCE_PROCESS_SYSTEM_INCLUDE_PATHS is not empty, we can ignore this + # requirement of 'found_basepath'. + # This is specifically useful for Flatpak build of PySide6 where For Flatpak the modules are in + # different directories. For Flatpak, although the modules are in different directories, they + # are all compatible. + if("${${_name_found}}" AND + ((("${found_basepath}" GREATER "0") OR ("${found_basepath}" EQUAL "0")) OR + (NOT SHIBOKEN_FORCE_PROCESS_SYSTEM_INCLUDE_PATHS STREQUAL ""))) message(STATUS "${module_state} module ${name} found (${ARGN})${looked_in_message}") # record the shortnames for the tests list(APPEND all_module_shortnames ${shortname}) |
