diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-05-10 08:00:02 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-05-17 16:46:59 +0200 |
| commit | 9a2a9bae00003f7dc0cea782bb10775aa25c8933 (patch) | |
| tree | 382566d7cc3b0c09b058569e348b707cf8faf732 /build_scripts/main.py | |
| parent | e6082b18b904569fc946b9f36fc995684463267f (diff) | |
Enable numpy support by default
This effectively undoes 36431b071095b8999347df87621bf23ffcc2ac3d
which disabled numpy support in libpyside due to
- break cx_freeeze
- Cause embedding applications to fail to load with "undefined symbol: PyExc_RecursionError"
Auto-detection along with --enable/--disable options is introduced
instead.
All numpy code is now located in libshiboken and it cleanly recovers
when numpy cannot be found on the target system. The
PyExc_RecursionError issue could not longer be reproduced.
[ChangeLog][PySide6] Numpy support is now enabled by default.
Task-number: PYSIDE-1924
Change-Id: I0fdb3612471971afa49ac3141845cf5d6dbfa7e0
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'build_scripts/main.py')
| -rw-r--r-- | build_scripts/main.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index 65ddca716..c983bf917 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -539,6 +539,17 @@ class PysideBuild(_build, DistUtilsCommandMixin, BuildInfoCollectorMixin): raise DistutilsSetupError("Error building patchelf") self._patchelf_path = os.path.join(self.script_dir, "patchelf") + def _enable_numpy(self): + if OPTION["ENABLE_NUMPY_SUPPORT"] or OPTION["PYSIDE_NUMPY_SUPPORT"]: + return True + if OPTION["DISABLE_NUMPY_SUPPORT"]: + return False + if self.is_cross_compile: # Do not search header in host Python + return False + # Debug builds require numpy to be built in debug mode on Windows + # https://numpy.org/devdocs/user/troubleshooting-importerror.html + return sys.platform != 'win32' or self.build_type.lower() != 'debug' + def build_extension(self, extension): # calculate the subrepos folder name @@ -655,9 +666,12 @@ class PysideBuild(_build, DistUtilsCommandMixin, BuildInfoCollectorMixin): if OPTION['AVOID_PROTECTED_HACK']: cmake_cmd.append("-DAVOID_PROTECTED_HACK=1") - numpy = get_numpy_location() - if numpy and not self.is_cross_compile: - cmake_cmd.append(f"-DNUMPY_INCLUDE_DIR={numpy}") + if self._enable_numpy(): + numpy = get_numpy_location() + if numpy: + cmake_cmd.append(f"-DNUMPY_INCLUDE_DIR={numpy}") + else: + log.warn('***** numpy include directory was not found.') if self.build_type.lower() == 'debug': if not self.is_cross_compile: @@ -779,7 +793,8 @@ class PysideBuild(_build, DistUtilsCommandMixin, BuildInfoCollectorMixin): "Use '--build-docs' to enable the documentation build") if OPTION["PYSIDE_NUMPY_SUPPORT"]: - cmake_cmd.append("-DPYSIDE_NUMPY_SUPPORT=1") + log.info("Warning: '--pyside-numpy-support' is deprecated and will be removed. " + "Use --enable-numpy-support/--disable-numpy-support.") target_qt_prefix_path = self.qtinfo.prefix_dir cmake_cmd.append(f"-DQFP_QT_TARGET_PATH={target_qt_prefix_path}") |
