aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/cmake/Macros
Commit message (Collapse)AuthorAgeFilesLines
* PySide: Fix debug buildShyamnath Premnadh2025-07-071-4/+15
| | | | | | | | | - Amends 9a87f647acebacc330c7f426465cf0b45e3d1375 to include debug build scenario. Change-Id: If5b00e93cfd7446a7f7e411bf4901db1009c02f2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Shiboken: Cleanup CMake configuration filesShyamnath Premnadh2025-07-041-0/+9
| | | | | | | | | | | - Removed unused variables in the Config file. SHIBOKEN_SHARED_LIBRARY_DIR and SHIBOKEN_INCLUDE_DIR can be obtained from the `libshiboken` cmake target as a property, and SHIBOKEN_PYTHON_MODULE_DIR can be obtained from PYTHON_SITE_PACKAGES Change-Id: I7a27f70055835c64029cee0bef33158e48f2d7a4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Modify headers installation for CMake buildsShyamnath Premnadh2025-07-041-1/+1
| | | | | | | | | | | | | | | | | | | Previously, the headers are installed as ${CMAKE_INSTALL_PREFIX}/include/cmake_package_name, where cmake_package_name is the CMake package name, e.g., PySide6. In the wheels, the headers were included as package_name/include. Since the level of the include directory is different, this caused issues when importing the CMake package in a downstream project. - This change modifies the installation of the headers so that the CMake install prefix and the wheels are consistent. - Additionally - this change adds the libpyside6 headers to the wheels. - The include headers for libshiboken were shipped with shiboken6-generator and not with shiboken6, which has the libshiboken binary. Change-Id: I96e3280799da169836e24551b906274f5b0fc962 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* build system: Switch to new cross compilation support of shiboken6Friedemann Kleint2025-06-271-19/+10
| | | | | | | Fixes: PYSIDE-3105 Change-Id: Ie91ee71e7cd9948e34f3425cf42ff18326d9abe9 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Ece Cinucen <ece.cinucen@qt.io>
* Make Remote Objects usable beyond ModelsBrett Stottlemyer2025-03-131-0/+1
| | | | | | | | | | | | While present, the Qt Remote Objects bindings to Python have not been very useful. The only usable components were those based on QAbstractItemModel, due to the lack of a way to interpret .rep files from Python. This addresses that limitation. Fixes: PYSIDE-862 Change-Id: Ice57c0c64f11c3c7e74d50ce3c48617bd9b422a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Brett Stottlemyer <brett.stottlemyer@gmail.com>
* Fix trailing empty linesFriedemann Kleint2024-12-131-1/+0
| | | | | | Pick-to: 6.8 Change-Id: I1a5964463f703ade0657816cb974206355a5ae5b Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* build: Install module doc snippet filesFriedemann Kleint2024-10-161-0/+9
| | | | | | | | | | Amends b55e221464c18053fa44f18132071ebdaee8f432. Task-number: PYSIDE-1106 Fixes: PYSIDE-2893 Pick-to: 6.8 Change-Id: I4a2688bfb5fcdddc5c6baea49d2fdc9c0f2381f1 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PySide: remove duplicates from the header include pathsShyamnath Premnadh2024-07-151-1/+3
| | | | | | | | | | - Remove duplicates for the '--include-paths' cli option passed to shiboken generator, when creating a PySide module. In the context of PySide module creation, shiboken generator is called from CMake. Pick-to: 6.7 6.5 Change-Id: Ibb489ef76df1126e60470aef0d248d8267381da8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add shibokenmodule dependency for all _pyi modulesŁukasz Patron2024-06-191-0/+4
| | | | | | | | | | | | | | When building on Fedora rawhide, we sometimes end up running generate_pyi.py script while shibokenmodule is still being built, resulting in the following error message: ImportError: (...)/Shiboken.cpython-313-x86_64-linux-gnu.so: file too short Pick-to: 6.7 Change-Id: I500679bf12e4ba5a820db6c7971f8cdb0012b965 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Łukasz Patron <priv.luk@gmail.com>
* Android Deployment: Build wheels with macOS hostShyamnath Premnadh2024-06-031-0/+29
| | | | | | | | | | | | - Additionally, also move setting Python_SOABI manually for Android to where FindPython CMake module is called. This also aids in naming the wheel correctly. Pick-to: 6.7 Task-number: PYSIDE-2766 Change-Id: I73c089d31e2ee629f3ed676965fca27d53882110 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix building without QtOpenGLFriedemann Kleint2024-04-091-0/+15
| | | | | | | | | | Introduce a CMake macro to either add the dependency or an entry to the dropped items for typesystem parsing. Pick-to: 6.7 Fixes: PYSIDE-2649 Change-Id: Idb4e6d530075ab8c08c92e2e26d4de1bfd0459cf Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Allow to disable pyi file generation for debuggingChristian Tismer2024-01-171-1/+1
| | | | | | | | | | | | | When developing difficult stuff like Lazy Initialization, it is convenient to have an option that ignores PYI generation. This way, translation can be successful, and pyi generation can then be debugged. Task-number: PYSIDE-2404 Change-Id: I68bd10af3754de3988556c4558d1331564f5dadb Pick-to: 6.6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add QRhi and related classesFriedemann Kleint2023-11-021-1/+4
| | | | | | | | | | | | CMake logic borrowed from the native interface patch. [ChangeLog][PySide6] QRhi and related classes have been added. Pick-to: 6.6 Task-number: QTBUG-113331 Change-Id: I9dd8b0b92f71027fc9f2c170af2993a5b09a4cfd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* CMake: Tell shiboken to process Qt headers inside system include dirsAlexandru Croitor2023-11-021-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building Qt For Python using yocto, the Qt headers are in a sysroot which libclang considers as system headers. Shiboken skips processing system headers. To ensure Qt headers are still processed, introduce a new --force-process-system-include-paths option to shiboken and two new CMake variables: PYSIDE_TREAT_QT_INCLUDE_DIRS_AS_NON_SYSTEM and SHIBOKEN_FORCE_PROCESS_SYSTEM_INCLUDE_PATHS. When PYSIDE_TREAT_QT_INCLUDE_DIRS_AS_NON_SYSTEM is set to true, the build system will pass the Qt include dirs to --force-process-system-include-paths to ensure the Qt headers are processed and their types extracted. Similarly SHIBOKEN_FORCE_PROCESS_SYSTEM_INCLUDE_PATHS can be passed a list of extra dir paths when creating non-Qt related bindings. Sysroots usually contain headers other than Qt headers, so there's a chance that a non-Qt-related system header fails to be be parsed and will fail the shiboken execution. To avoid breaking setups that previously worked because of the issue described above, the new options are opt-in rather than opt-out. In case one such an issue is encountered, the solution would be to copy / move the Qt headers into a separate location and specify the new location as both an include path and a force process system include path (in case the copied headers are still somewhere under the sysroot). Pick-to: 6.6 Task-number: PYSIDE-1958 Change-Id: I1733478e9c6057f84de7864940c6150b378749cf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* CMake: Fix installation of pyi filesChristophe Marin2023-06-061-5/+1
| | | | | | | | | | | | | | 'file(GLOB ...)' cannot be used since these files are generated at build time. Patch by Julien Schueller. Fixes: PYSIDE-2184 Pick-to: 6.5 Change-Id: I33f614f7a18082ca274ef0580af08492121cf895 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add license headers to cmake filesFriedemann Kleint2023-02-162-0/+6
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Task-number: QTBUG-105718 Task-number: QTBUG-88621 Change-Id: I98bd2e80f182d8bf7aef6b633f37a428e2dac69b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Remove unused FindQt5Extra.cmake fileFriedemann Kleint2022-11-291-25/+0
| | | | | | Pick-to: 6.4 Change-Id: I3208725f2870254a53faa3d1c208c2d2096334bc Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* CMake: Execute shiboken with appropriate PATH on WindowsAlexandru Croitor2022-11-091-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously one had to add the Qt bin dir and libclang.dll dir to PATH manually to ensure shiboken successfully runs when building Qt for Python using CMake without setup.py. This should not be necessary though, because the build system knows where Qt is (usually via the --qtpaths option) and where libclang is (via LLVM_INSTALL_DIR and friends). Introduce a CMake function that generates a batch shell script wrapper for a given tool. The wrapper will have PATH set to the Qt bin dir and libclang dir. Generate such a wrapper for shiboken and use it everywhere we call shiboken to generate bindings. The wrapper is only created on Windows. All mentions of Shiboken6::shiboken in custom commands now need to be wrapped in $<TARGET_FILE> because automatic target path conversion only happens if the target appears as the first argument to a custom command, and that is not the case anymore with the wrapper script being at the front. As a drive-by, the indentation of custom commands is now adjusted for easier readability and to conform with the indentation used in the Qt build system. Pick-to: 6.4 Fixes: PYSIDE-1844 Change-Id: I287adeedf234d0272c2963e96ae2aa5c4c0f0c83 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add --lean-header optionFriedemann Kleint2022-11-031-0/+1
| | | | | | | | | | | | | | | | | | | | | Add an option that causes shiboken to generate forward declarations instead of includes where possible into the module header. This works since SbkType<> template specializations work with forward declarations. Includes are only required for certain classes (with enums, inner classes). [ChangeLog][shiboken6] An option --lean-header to generate forward declarations instead of includes into the module header has been added. This considerably reduces the dependencies but may require additional includes to be specified for injected code. Pick-to: 6.4 Fixes: PYSIDE-2099 Change-Id: I01f639e4ccce5ca25016dc2d52562abcc489a5ab Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Add Qt bin dir to PATH when calling generate_pyi.pyAlexandru Croitor2022-11-021-1/+11
| | | | | | | | | | To ensure the Qt modules can be imported, even if Qt is not in PATH. Pick-to: 6.4 Task-number: PYSIDE-1844 Change-Id: I64d939c0323980ce2292b48ca59cef138a979ebc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Build with lean Qt headersFriedemann Kleint2022-06-291-0/+2
| | | | | | | | | This should speed up compilation time. Task-number: QTBUG-97601 Change-Id: Ibd25739dfe5032113ff9c1df5ff5da4cf9effc2d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* PySide6: Optimize for SizeShyamnath Premnadh2022-04-111-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | build: use the following flag with setup.py to turn off size optimization --no-size-optimization Added the following compiler optimization flags and their corresponding flags on other platforms GCC - -ffunction-sections -fdata-section which segretates data and function section and linker flag --gc-section which removes unused code. - -fno-exceptions to disable exception handling - -Os - Optimize for size. Basically same as -O2 but removes some flags that cause increase in size. (Ran a couple of example and did not see difference in execution time) MSVC - /Gy /Gw /OPT:REF - same as -ffunction-sections, -fdata-section, -Wl, --gc-section - /EHsc same as -fno-exceptions - /O1 instead of /Os because for MSVC /O1 gave the best results. Clang - Same as GCC except for using -Oz instead of -Os. Experiments: Built a wheel with QtCore and noticed a 300kb reduction in size on both Windows and Linux. Built a complete wheel(except QTest) and it gives me a 4 mb size reduction with unaffected performance. Task-number: PYSIDE-1860 Change-Id: Ia5dfa2c4bfde92994c939b5fac0d0831fa3a73ab Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Strip libraries in release modeFriedemann Kleint2022-03-141-0/+1
| | | | | | | | | [ChangeLog][PySide6] Libraries are now stripped. Task-number: PYSIDE-661 Change-Id: I20ea056b8e91cca917017afa62811208c297d51d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* CMake: pyside: Add support for cross-buildingAlexandru Croitor2022-02-041-14/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | The pyside project will be cross-compiled either if CMAKE_CROSSCOMPILING is set to TRUE (which is usually set by a CMake toolchain file or computed by CMake itself) or if QFP_SHIBOKEN_HOST_PATH is provided on the command line. Various code is added to ensure the correct target Qt, Python and Shiboken libraries are found, as well as host Qt and shiboken tools. These are specified to the project by setting one of the following vars: - QFP_QT_TARGET_PATH (for device Qt libs and includes) - QFP_PYTHON_TARGET_PATH (for device python libs and includes) - QFP_SHIBOKEN_TARGET_PATH (for device libs) - QFP_SHIBOKEN_HOST_PATH (for host shiboken generator) - QT_HOST_PATH (for host moc and friends) When cross-compiling, pyi file generation is disabled because it's not possible to run a target python interpeter on a host machine. It might be possible to do that by using qemu userland emulation in the future. Task-number: PYSIDE-802 Task-number: PYSIDE-1033 Change-Id: Ifa101e90d83397fa19132f9f0ce21e03b3523a74 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Move the QML registration code into a libraryFriedemann Kleint2021-12-081-1/+1
| | | | | | | | | This makes the code easier to maintain. Task-number: PYSIDE-1709 Change-Id: Idb75143a7e6d218637ab75463db88b6135cd4086 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Revert "PySide6: Fix missing includes in QtWebEngine"Friedemann Kleint2021-07-211-7/+0
| | | | | | | | | | This was a workaround. This reverts commit 096e64ba2e866abf773f0fab3b72bf48012261f7. Change-Id: I1b1baf8de73bdb235c21ed673893d4e3a0f5054e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Fix missing includes in QtWebEngineFriedemann Kleint2021-06-231-0/+7
| | | | | | | | Temporary workaround, to be reverted later. Task-number: PYSIDE-1570 Change-Id: I113c82236ebeebd3a0ecd31dbcecbb7704dc8d7c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Refactor macro create_pyside_module()Friedemann Kleint2021-06-041-28/+31
| | | | | | | | | | | | | | | | | | | | | | - Introduce a list variable shiboken_command to which elements can be appended, avoiding empty options (--drop-type-entries) - Use the include directories from Qt6::Platform instead of the global QT_INCLUDE_DIR since it also has the mkspecs directory containing qplatformdefs.h. - Introduce list variables for the shiboken include directories and framework include directories as an extension point where other directories can be added. - Remove old workaround for qtdeclarative/8d560d1bf0a747bf62f73fad6b6774095442d9d2. - Move positional arguments (global header and typesystem) to end of argument list. Pick-to: 6.1 Task-number: PYSIDE-802 Task-number: PYSIDE-1568 Change-Id: Id4d020a163c79010616749701251891545858447 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* move "shiboken6/shiboken6" to "shiboken6/Shiboken"Christian Tismer2021-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | Modifying the paths to work in the new way is a quite ambitious task. But doing so improves the overall project structure and makes imports unambiguous. This patch should not be applied alone but with move "shiboken6/shiboken6" to "shiboken6/Shiboken" temp The reworked version of this patch no longer has different structures in `build` and `install`. Tested with Python 3.6, 3.7, 3.8, 3.9 debug build Python 3.6 debug install Python 3.9 release install Task-number: PYSIDE-1497 Change-Id: Id9d816dd825907f9359651e7e2f69f54e1ba46c9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-023-0/+289
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>