aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/cmake
Commit message (Collapse)AuthorAgeFilesLines
* Fix propagation of existing LD env vars when calling generate_pyiAlexandru Croitor2019-05-211-9/+20
| | | | | | | | | | | Existing PATH, LD_LIBRARIES_PATH or DYLD_LIBRARY_PATH values should be appended to the ones we set ourselves. This takes care of finding any system libraries which a distro / OS might set by default. Change-Id: I1b3d1ea20c024e8ffcba3fb38d9088917130abfe Fixes: PYSIDE-1008 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* generate_pyi: Simplify, Enhance and Get Rid Of Any Import ProblemsChristian Tismer2019-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The generate_pyi.py script always had the problem that it was not easy to distinguish different kinds of ImportError. When ImportError was raised during a build, we assumed it was just a not-yet built module and ignored it. When patch 97df448e "Modernize cmake build" was checked in on 2019-02-07, a real import error was introduced on Windows. It was not recognized until 2019-05-13 that Windows had stopped generating .pyi files. It was discovered by working on an enhancement to dependency checks that erroneously looked for "libshiboken*" on windows. This should have raised an error in "generate_pyi.py" but did not, because the generation was skipped due to the real ImportError. General Redesign ---------------- It turned out that all the former difficulties with importing modules could be completely avoided, by explicitly using the inherent dependencies. The script was drastically simplified by using the module name as an argument. It was not clear in the first place that this would work, but actually we recognized that all modules a script wants to import are already built when CMake starts the .pyi generation. The only visible quirk is the pair QtMultimedia/QtMultimediaWidgets where both modules must be compiled before generating. (maybe that is an error in our XML files, or a Qt "feature"?) Enhancements ------------ The generate_pyi script is now completely deterministic, because all imports are enforced to work. There is no more polling for translated modules necessary. Everything is generated after a module was linked, The "--skip" semantic was first enhanced much further. In the end it was recognized that we don't need the parameter any longer, because with the determinism we are never computing a pyi file more than once. The parameter was then completely removed. The "--check" option was added for Python 3. It takes some time and is only automatically active in a COIN build. Task-number: PYSIDE-735 Change-Id: I3cc58f6cad80d8208e17f62d472fd48aa6aeebd6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix pyi generation on WindowsAlexandru Croitor2019-05-141-0/+13
| | | | | | | | | | | | | | When trying to generate the pyi files on Windows, the python modules failed to be imported due to Qt dlls not being in PATH. This happened because we overrode PATH instead of prepending to it. When generating pyi files on Windows, make sure to prepend new values to PATH while also keeping the old values. Amends 97df448edbc035a2f531508a5cfe5739fb2de18d Change-Id: I74c374c3a9687169dd4af0ed232bda76a0267fc4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Make .pyi file generation a standalone CMake targetAlexandru Croitor2019-02-071-4/+8
| | | | | | | | | | | Rather than using add_custom_command(TARGET foo POST_BUILD) for pyi file generation, use add_custom_target() with add_dependencies() instead. Semantically it should have the same meaning, but I'm hoping this will eliminate the weird race condition build issues that occur with manifest embedding on Windows. Change-Id: I854b8f80fd39363723ab2661b2423461396efc11 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Modernize cmake buildAlexandru Croitor2019-02-071-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a CMake super project that includes the shiboken2, PySide2 and pyside2-tools subprojects, so that it's possible to build everything from Qt Creator (or any other IDE that supports CMake) with minimal set up effort, and thus inform the IDE CMake integration of all relevant files, for easier code editing, navigation and refactoring. This also lays the foundation for allowing 3rd parties to use the shiboken2 generator to generate custom modules. This is achieved by eliminating various hardcoded paths for libraries and include directories. Start using CMake targets throughout the build code to correctly propagate link flags and include dirs for libshiboken and shiboken2 executable targets. Same for the libpyside target. Generate two separate cmake config files (build-tree / install-tree) that can be used with find_package(Shiboken2), to make sure that the PySide2 project can be built as part of the super project build. This is currently the only way I've found to allow the super build to work. Note that for the build-tree find_package() to work, the CMAKE_MODULE_PATH has to be adjusted in the super project file. The generated config files contain variables and logic that allow usage of the installed shiboken package in downstream projects (PySide2). This involves things like getting the includes and libraries for the currently found python interpreter, the shiboken build type (release or debug), was shiboken built with limited api support, etc. Generate 2 separate (build-tree and install-tree) config files for PySide2, similar to how it's done for the shiboken case, for pyside2-tools to build correctly. Install shiboken2 target files using install(EXPORT) to allow building PySide2 with an installed Shiboken2 package (as opposed to one that is built as part of the super project). Same with PySide2 targets for pyside2-tools subproject. Make sure not to redefine uninstall targets if they are already defined. Add a --shorter-paths setup.py option, which would be used by the Windows CI, to circumvent creating paths that are too long, and thus avoiding build issues. Output the build characteristics / classifiers into the generated build_history/YYYY-MM-DD_AAAAAA/build_dir.txt file, so it can be used by the test runner to properly filter out blacklisted tests. This was necessary due to the shorter paths options. Fix various issues regarding target includes and library dependencies. Remove certain duplicated cmake code (like limited api check and build type checks) in PySide2, given that that information will now be present in the exported shiboken2 config file. Include a short README.cmake.md file that describes how to build the super project. References used https://rix0r.nl/blog/2015/08/13/cmake-guide/ https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/ https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1 https://cliutils.gitlab.io/modern-cmake/chapters/basics/functions.html https://cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html https://github.com/ComicSansMS/libstratcom/blob/master/CMakeLists.txt Abandoned approach using ExternalProject references: https://cmake.org/cmake/help/latest/module/ExternalProject.html https://stackoverflow.com/questions/44990964/how-to-perform-cmakefind-package-at-build-stage-only Fixes: PYSIDE-919 Change-Id: Iaa15d20b279a04c5e16ce2795d03f912bc44a389 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Avoid creation of empty build directories in install treeStefan Brüns2019-01-081-3/+3
| | | | | | | | Initial-patch-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Change-Id: Ia1f86a8c8926dda2072a10757928497067580dca Fixes: PYSIDE-882 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* generate_pyi.py: Add --quiet optionFriedemann Kleint2018-12-111-4/+8
| | | | | | Task-number: PYSIDE-735 Change-Id: I864270454bf4f7eee1a28b55ed06ffbf1c60d74d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Make it hard to use the create_pyside_module function incorrectlyAlexandru Croitor2018-12-071-53/+83
| | | | | | | | | | | | Rewrite the function to use keyword arguments instead of ordered arguments. Also add error detection when required arguments are not passed, or have a typo in them. Adjust all the module cmake files to use keyword arguments. Change-Id: I7bb0c6561d7dca1e7f673e29eb457da50ae5df04 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Generate Hinting Stubs AutomaticallyChristian Tismer2018-12-031-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The script is now automatically called in the cmake build, as part of the create_pyside_module macro. The script runs after every module build and tries to generate .pyi files. This does not need to succeed, but will generate all files in the end. The script has been prepared to allow partial runs without overhead. After integration of the .pyi generation into cmake, these files are also installed into the install directory by cmake. For wheel building, setup.py has entries, too. Building a full project with all modules revealed a bug in the signature module that allowed unsupported function objects. Module enum_sig had to be changed to suppress types which have no ancestry in shiboken. PYTHONPATH was avoided because it was not Windows compatible. Instead, the script was changed to accept "--sys-path" and "--lib-path" parameters. The latter evaluates either to PATH or LD_LIBRARY_PATH. The necessity to create .pyi files while the project is in the build process showed a hard to track down error condition in PySide_BuildSignatureProps. Simple logging was added as a start of introducing logging everywhere. Task-number: PYSIDE-735 Change-Id: I6b3eec4b823d026583e902023badedeb06fe0961 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Remove some cmake dead codeAlexandru Croitor2018-11-291-16/+0
| | | | | | | | Some code was left over since the rewrite done in a80a6eb94433529a6d984e8ff22874f7dff48eea Change-Id: Ie862cea690dc54ad35d711b5fecfb58d51b03b88 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Install snippets glue codeCristian Maureira-Fredes2018-11-281-2/+27
| | | | | | | | | | | | | The module-specific glue files as well as the standalone glue files are now installed into the PySide2 package. The glue files are now also listed as dependencies for the shiboken generator run, which means that modifying those files will now correctly force a shiboken re-run for the relevant modules. Change-Id: I545c7ada379fafb7f225d0b0f5ce495bf6d4795d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Improve build rules for module generationAlexandru Croitor2018-10-231-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously whenever a typesystem XML file changed, this resulted in a full rebuild of all cpp files generated for that particular module. This change shifts the rules of building in such a way, that files are rebuilt only if their content has changed. XML modifications should generally not cause full rebuilds anymore, unless the change is in a global header. This is achieved in the following way, assuming a binding library "foo" added by add_library(foo ...): 1) CMake calls shiboken via add_custom_command. 2) The OUTPUT file for the command is the generated mjb_rejected_classes.log file, which serves as a timestamp for when shiboken was last run. 3) All the generated cpp files are marked as "Generated" via the add_custom_command BYPRODUCTS option. This allows the files to have an older timestamp than that of an XML file, thus not forcing constant shiboken re-execution. 4) A new custom target foo_generator is added via add_custom_target. 5) This target has a dependency on the mjb_rejected_classes.log file, and the target itself is added as a dependency to the "foo" target. 6) Whenever "foo" is built, it will first try to build "foo_generator" which will force the shiboken custom command to be run, which will generate the cpp files and mjb_rejected_classes.txt file. The BYPRODUCT cpp files can then be used as sources in the "foo" target. 7) If a user modifies the XML file listed in the add_custom_command DEPENDS option, this will re-trigger shiboken execution, which will create a new mjb_rejected_classes.log file, which means that the "foo" target might be rebuilt if, and only if, any of the cpp file timestamps are new. Otherwise "foo" doesn't need to be rebuilt. Change-Id: I9a3844a2fa775106288acc01cb4570a903e16991 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide2: Replace macro check_qt_class by the Qt configure systemFriedemann Kleint2018-10-011-71/+0
| | | | | | | | | | | | Query the feature properties of the configure system to check whether a class is present instead of running a compile test in QtGui and QtNetwork. Remove the macro invocation from QtWigets since the results (QtWidgets_OPTIONAL_SRC, QtWidgets_DROPPED_ENTRIES) were not used. Change-Id: I06e03fe1eef85f2340ab4cdb130b8b31b08f7f14 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-02-021-2/+8
|\ | | | | | | Change-Id: I777970f7bb17db766660d82556559eadd7293355
| * Fix QSsl classes to be picked up on LinuxAlexandru Croitor2018-02-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | The compile tests that checked for QSsl classes silently failed because of two different reasons: 1) If Qt was compiled with -fPIC, but the tests weren't, we hit a compilation error. Solution is to compile with -fPIC if necessary. 2) For some reason when linking, the linker can't find the qt version tag symbol. Solution is to simply not use the version tag. Task-number: PYSIDE-599 Change-Id: If8a6ea38b45091bcaced6179a71195d25589ef18 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Fix system framework handling on macOSAlexandru Croitor2018-01-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | System framework paths queried from the system clang compiler should be re-added to libclang via the -iframework command line argument instead of -F, so that they appear at the bottom of the list of candidate include search paths. This prevents issues with picking up incorrect headers, like an installed official package of Qt 4.8. Also there is no need to use CMAKE_SYSTEM_FRAMEWORK_PATH like in the 5.6 branch because it duplicates the list of includes and also causes conflicts with the same paths being added as both system and non-system include paths. It was necessary in 5.6 branch because the list of include paths was not queried from the clang compiler. Change-Id: I04b299fc5bc759842a0ab890a85170f153932e79 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Use cmake install for typesystem filesFriedemann Kleint2018-01-151-1/+2
| | | | | | | | | | | | | | | | | | | | install is better suited for distro installation due to permission issues. Amends 5d5eed53e49f4aaea85ce1638dd6fa3774a960e0. Task-number: PYSIDE-589 Change-Id: I6539b7c9957fd542a39b68e2d63a66f544414cd7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Remove modules from typesystem files when installingFriedemann Kleint2018-01-121-1/+12
| | | | | | | | | | | | | | | | | | | | | | The typesystem files end up in a flat directory after installing, so, the include by module name introduced by f2063ee4737f90c5d412a9a328672fde32b033eb no longer works. Remove the module in the install step. Task-number: PYSIDE-584 Change-Id: I6d0acdc26ee865c7e452bb702b7383579eef060d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | PySide2: Simplify typesystem path handlingFriedemann Kleint2017-11-061-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify the typesystem.xml files such that all dependent files are loaded via module (for example, QtCore/typesystem_core.xml). As a result, it is no longer necessary to add each dependent directory to the typesystem path; it is sufficient to pass the binary and source path of PySide2 and the source directory of the Qt module only. This requires rewriting the dependency checking for --reuse-build so that it loops over the source directories of the dependent Qt modules. Change-Id: Ib234c2673f4ee93cc8a3282fac69bcfcfaebd0ac Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | PySide2: Run shiboken2 with a single Qt module headerFriedemann Kleint2017-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | Create a per-module header including pyside2_global.h and the module header only instead of passing a global header including all Qt modules. This reduces the amount of code shiboken2 has to parse and minimizes warnings. Change-Id: If3ab8fdf6cabe17b4add65f1e4a0f2e1464ab164 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Windows: Define NOMINMAX for every moduleFriedemann Kleint2017-10-071-0/+2
| | | | | | | | | | | | | | | | As of 5.10, windows.h is included by qrandom.h in QtCore. Task-number: PYSIDE-431 Change-Id: I69cc5e3275fba09f1a4990a4e5d37253b4664a95 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-08-281-1/+1
|\| | | | | | | Change-Id: I073b05f8b39c0af32aa57ce3589c1aac2d712213
| * consistently name site-packages in Shiboken and PySideChristian Tismer2017-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The variable used for the python site-packages is inconsistent. Instead of "SITE_PACKAGE", we use "PYTHON_SITE_PACKAGES" everywhere. Task-number: PYSIDE-563 Change-Id: I4d2d49f20f5a0a13439bc7b8c79ab318cd831cb9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Julien Schueller <schueller@phimeca.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Fix the chain of issues regarding QSslConfigurationAlexandru Croitor2017-08-241-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The failure was seen on Windows CI build, but was actually present on all platforms if the QSsl checks were properly fixed, or if certain CMake versions randomly decided to force C++11 usage. The first issue was that QSsl wrappers were not generated on all platforms because the C++11 standard was not forced for the compilation tests done in the check_qt_class macro. This is a bug in CMake, and the official way of fixing this is introduced in the yet unreleased CMake 3.9 version. The current fix is a workaround to explicitly pass the C++11 standard switch to the try_compile invocation. The next issue concerns handling of const char[] C++ types. There are three such members in QSslConfiguration, which caused build failures due to incorrectly generated code. The solution is to treat "const char[]" types as "const char*" types, which generates correct conversion code. Tests were also added to check for such cases. Change-Id: I874a3591dfc5f385338de7e3aff2a2c0dd2f5719 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-07-141-3/+0
|\| | | | | | | Change-Id: I1dd2958b252b82e8699e8d2212afdce0086a16d2
| * Fix Windows module extensions and tests to work with --debug buildAlexandru Croitor2017-07-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the same imp.get_suffixes() mechanism as on Unix, to determine the suffix part of module extension files. This fixes debug builds to work on Windows. Note that the whole build stack has to use the same configuration, no mixing is allowed on Windows. For release build you need: python.exe + setup.py without --debug flag + release build of Qt5. For debug build you need: python_d.exe + setup.py with --debug flag + debug build of Qt5. Change-Id: I6188c859b5757d11e87d6a9e32b9ba558f7f609e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-06-231-4/+3
|\| | | | | | | Change-Id: Ieeaa4659753416315a619d0b683a3e5a4c8ed54e
| * Fix compile tests to include correct module include dirsAlexandru Croitor2017-06-231-4/+3
| | | | | | | | | | | | | | | | | | Also include the optional QtNetwork sources, so that QSsl* class bindings are properly generated. Thus the optional QtWidgets and QtNetwork classes should be picked up. Change-Id: Id4d21dc577f2b551dce83999be76cdfd9d0b88d2 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * move everying into sources/pyside2Oswald Buddenhagen2017-05-223-0/+232
| | | | | | in preparation for a subtree merge. this should not be necessary to do in a separate commit, but git is a tad stupid about following history correctly without it.
* move everying into sources/pyside2 (5.9 edition)Oswald Buddenhagen2017-05-223-0/+237
in preparation for a subtree merge. this should not be necessary to do in a separate commit, but git is a tad stupid about following history correctly without it.