aboutsummaryrefslogtreecommitdiffstats
path: root/examples/samplebinding
Commit message (Collapse)AuthorAgeFilesLines
* Replace cmake -H with -SAdrian Herrmann2024-03-111-3/+3
| | | | | | | | | | | | The previously undocumented cmake -H has been replaced with the official -S in 3.13, update the documentation accordingly: https://cgold.readthedocs.io/en/latest/glossary/-H.html Pick-to: 6.6 Change-Id: I54fb700a36746b49a04449e8c9af21fd2bd235c7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Improve the samplebinding build instructions for WindowsFriedemann Kleint2024-02-121-1/+1
| | | | | | | | | Add CMAKE_C_COMPILER definition to prevent CMake from falling back to Clang. Pick-to: 6.6 6.5 Change-Id: I755d6c99f84293c680e56b7cfa7af3f7fb0dd934 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Replace options related to nb_zero by nb_boolFriedemann Kleint2023-09-061-1/+1
| | | | | | | | | | | | | | nb_zero is Python 2 terminology. Rename the related functions and use new options. [ChangeLog][shiboken6] The command line options --use-operator-bool-as-nb_nonzero and --use-isnull-as-nb_nonzero have been replaced by --use-operator-bool-as-nb-bool and --use-isnull-as-nb-bool, respectivily to match Python 3 terminology. The old options continue to work. Change-Id: I1201f4b15e021c8df96740149c20fa1478c12ae1 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* doc: fix issues with pyside rst filesCristián Maureira-Fredes2023-04-051-2/+1
| | | | | | | | | | Fixing extra indentation, syntax issues, and formatting. Adapting too some snippet line highlights, and many other details. Pick-to: 6.5 Change-Id: Ife4eb5cec03577b2902d409b4007ae6d12141747 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Unify the shiboken sample binding example descriptionFriedemann Kleint2023-03-274-2/+50
| | | | | | | | | | | | | Merge the description from the shiboken documentation into the newly added example samplebinding.rst file, re-using the existing image. Add the sections from the shiboken documentation to the source files via .rstinc files. Task-number: PYSIDE-1106 Pick-to: 6.5 Change-Id: I22f7302aa10ce2a47283b01315b2d4c9daf9f9ed Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add license headers to cmake filesFriedemann Kleint2023-02-161-0/+3
| | | | | | | | | | | | 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>
* Build system: Bump versionsFriedemann Kleint2022-10-251-2/+2
| | | | | | | | | | | | State CMake 3.18+ and Python >= 3.7 Task-number: PYSIDE-2091 Pick-to: 6.4 Change-Id: Iad906a48bf4378ceeeebe5a55aeaa3f27ea0a61f Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix binding,scriptable examples when no build typeAdrian Herrmann2022-08-221-2/+2
| | | | | | | | | | | | Fix a problem where building the samplebinding, widgetbinding and scriptableapplication examples would fail if the CMAKE_BUILD_TYPE variable was not explicitly set. Amends f9f620436058efe93d086c5214955c4d56e70e26. Pick-to: 6.2 6.3 Change-Id: I6fa8afc386d259a16812bd69148d6299f3b70233 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix binding, scriptable examples for Windows debugAdrian Herrmann2022-08-091-2/+20
| | | | | | | | | | | | | | Fix the samplebinding, widgetbinding and scriptableapplication examples for debug configurations on Windows: 1. Account for the python_d executable name vs python 2. Same for the pyd file name for the binding examples (module_d.pyd instead of module.pyd) Pick-to: 6.2 6.3 Change-Id: I60933e8968401e03c829b797c5bc67a4db8d115d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-278-383/+16
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Examples: Raise C++ standard to 17 for Qt 6Friedemann Kleint2022-05-131-2/+2
| | | | | | | Pick-to: 6.3 Change-Id: I55bbaeff95bc55aef6a5e13f18a42752c29f61d8 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* examples: replace http by httpsCristián Maureira-Fredes2022-04-011-1/+1
| | | | | | Pick-to: 6.2 Change-Id: Ib53667e03a2dea2afea73a344d5749d37d59c52b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Polish the samplebinding exampleFriedemann Kleint2022-03-215-37/+44
| | | | | | | | | | | - Use a std::shared_ptr for internal storage. - Simplify copy and assignment. - Fix constness of the flavor accessor - Add ostream operator to IceCream Pick-to: 6.2 Change-Id: I814fa14095cbb96ab5642735e16b8b50101d4771 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* samplebinding example: Remove primitive type definitionsFriedemann Kleint2021-12-102-11/+5
| | | | | | | | Those types are now built-in. Task-number: PYSIDE-1660 Change-Id: Id09a44ae5d216db8abee034a6b136c3c8bab3b2d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Update example documentation of samplebinding / scriptableapplicationFriedemann Kleint2021-12-103-9/+21
| | | | | | | | Update versions and build information. Pick-to: 6.2 Change-Id: I82eb4b36e2357145f89bb640f2674deda6fe2253 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Document the scriptableapplication, samplebinding examplesFriedemann Kleint2021-12-082-102/+140
| | | | | | | | | | Add a dummy .pyproject file into the doc directory for the example gallery script to collect it. Convert the .md files to .rst files for the documentation. Pick-to: 6.2 Change-Id: I87ea5b980d3d2177a7851f71462ca0b0bd0eba7e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* examples: clean and improve codeCristian Maureira-Fredes2021-05-131-1/+1
| | | | | | | | | | - removing '\' from long lines, - use f-strings instead of concatenating strings - Use f-strings instead of the old '%' formatting Task-number: PYSIDE-841 Change-Id: I4983c25a6272e10119d5d1a74c180828ca6f64e6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* sample binding: Document how to force MSVC in case CMake detects clangFriedemann Kleint2021-05-081-1/+7
| | | | | | | Pick-to: 6.1 6.1.0 Task-number: PYSIDE-1112 Change-Id: I9eefeb12c1609ee0fda4fd0ab160b25f82813f6a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Examples: Fix some space-related flake warningsFriedemann Kleint2021-04-291-0/+3
| | | | | | Task-number: PYSIDE-1112 Change-Id: Ib8991199e4822673d6a25cba0023dbe3b03f5938 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Examples: Use new form of super()Friedemann Kleint2021-04-282-3/+3
| | | | | | Task-number: PYSIDE-1112 Change-Id: Ifcb4da974bdcad7af536404fffdbffc585d3d167 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Update and unify README.md of our binding examplesFriedemann Kleint2021-02-231-13/+16
| | | | | | | | ninja is the only working generator for Qt 6. Pick-to: 6.0 Change-Id: I9640f646ffea7b21659966680df52a21ead7119d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-022-3/+3
| | | | | | | | Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Binding Example helpers: Remove version numbersFriedemann Kleint2020-11-022-21/+21
| | | | | | | | - Rename the scripts - Introduce variables for the versions in pyside_config.py Change-Id: I1dcb8ca7eee259f25af0db7c09abd30484c7e99c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* examples: Remove Python 2.7 and <3.6 related codeCristian Maureira-Fredes2020-10-282-4/+2
| | | | | | | | | | * removing from __future__ import ... * updating CMakeLists.txt files * removing special if-else for Python 2 and 3 Change-Id: I8a34b06b6b384ebc5323f20f7c15c357a5be6d62 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-282-8/+8
| | | | | | | | Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I4cb5ee4c8df539546014b08202a7b1e98ed3ff07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-305-1/+22
|\ | | | | | | Change-Id: I13721e13d2fab13945385fe529afe4ab431e0532
| * samplebinding: Add a sample property definitionFriedemann Kleint2020-09-295-1/+22
| | | | | | | | | | | | Task-number: PYSIDE-1019 Change-Id: Ieecd08c451c47951ebe05d86b0932ef2682821aa Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Bump cmake version to 3.16Friedemann Kleint2020-09-041-2/+2
|/ | | | | | | | | | Streamline the features list handling in the module CMakeLists to use the list functionality introduced in cmake 3.3. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I184034cae408c815bd80a09016a21fde2969449e Reviewed-by: Christian Tismer <tismer@stackless.com>
* samplebinding: Fix running with Python 3.8.2 on WindowsFriedemann Kleint2020-05-051-14/+6
| | | | | | | | | | | Copy the shiboken DLL into the source directory. Since it does not make sense to hardlink into the build directory and install to another directory, remove the hardlink logic. Fixes: PYSIDE-1236 Change-Id: I016dac916502f4c28785981244e29e91e61700fe Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Change example scripts permissions to 644Cristian Maureira-Fredes2018-12-121-1/+0
| | | | | | | | | | | There was a mix of 644 and 755, since we expect the users to execute: python example.py we do not need to have files with 755. Change-Id: Iba9b2f5dbb57fe2a3503d8dfe971a4e92e764022 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simo Fält <simo.falt@qt.io>
* Add tests to install built wheels and build some examplesAlexandru Croitor2018-10-121-2/+7
| | | | | | | | | | | | | | | | | | | | Augment coin_test_instructions.py to run a new script testing/wheel_tester.py, which tries to pip install the built wheels, and then tries to build the samplebinding and scriptableapplication examples. This allows us to confirm that the generated wheels are actually installable, and also hopefully prevent us from breaking the embeddable examples, by making sure that they at least build (and execute in the case of samplebinding). The change also modifies the examples to be able to take the python executable as build argument, so that wheel_tester can specify explicitly which python interpeter to use. Change-Id: I0f141e40ab86e3311dd25915c4e53b0af36aaae9 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Allow building shiboken2 and PySide2 as separate wheelsAlexandru Croitor2018-10-121-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actually this creates 3 wheel packages: - shiboken2 (the python module and libshiboken shared library) - shiboken2-generator (contains the generator executable, libclang and dependent Qt libraries) - PySide2 (the PySide2 modules and Qt shared libraries, and tools like rcc, uic) Calling the setup.py script will not do the actual build now (in the sense of calling CMake, make, etc.). Instead it will spawn new processes (via subprocess.call) calling the same setup.py script, but with different arguments. These "sub-invocations" will do the actual building. Thus, the "top-level invocation" will decide which packages to build and delegate that to the "sub-invocations" of setup.py. A new optional command line argument is introduced called "--build-type" which defaults to "all", and can also be set to "shiboken2", "shiboken2-generator" and "pyside2". A user can choose which packages to build using this option. The "top-level invocation" uses this option to decide how many "sub-invocations" to execute. A new command line argument called "--internal-build-type" takes the same values as the one above. It defines which package will actually be built in the new spawned "sub-invocation" process. The "top-level invocation" sets this automatically for each "sub-invocation" depending on the value of "--build-type". This option is also useful for developers that may want to debug the python building code in the "sub-invocation". Developers can set this manually via the command line, and thus avoid the process spawning indirection. A new class Config is introduced to facilitate storage of the various state needed for building a single package. A new class SetupRunner is introduced that takes care of the "--build-type" and "--internal-build-type" argument handling and delegation of "sub-invocations". A new class Options is introduced to 'hopefully', in the future, streamline the mess of option handling that we currently have. setup.py now is now simplified to mostly just call SetupRunner.run_setup(). Certain refactorings were done to facilitate further clean-up of the build code, the current code is definitely not the end all be all. Various other changes that were needed to implement the wheel separation: - a new cmake_helpers directory is added to share common cmake code between packages. - the custom popenasync.py file is removed in favor of using subprocess.call in as many places as possible, and thus avoid 10 different functions for process creation. - Manifest.in is removed, because copying to the setuptools build dir is now done directly by prepare_packages functions. - because prepare_packages copies directly to the setuptools build dir, avoiding the pyside_package dir, we do less copying of big Qt files now. - versioning of PySide2 and shiboken2 packages is now separate. shiboken2 and shiboken2-generator share the same versions for now though. - shiboken2 is now listed as a required package for PySide2, to facilitate pip requirements.txt dependencies. - coin_build_instructions currently needs to install an unreleased version of wheel, due to a bug that breaks installation of generated wheel files. - added separate command line options to pyside2_config.py for shiboken2-module and shiboken2-generator. - adapted samplebinding and scriptableapplication projects due to shiboken being a separate package. - adapted pyside2-tool and shiboken2-tool python scripts for setup tools entry points. - made some optimizations not to invoke cmake for shiboken2-generator when doing a top-level "all" build. - fixed unnecessary rpaths not to be included on Linux (mainly the Qt rpaths). Task-nubmer: PYSIDE-749 Change-Id: I0336043955624c1d12ed254802c442608cced5fb Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add an example that demonstrates bindings to a custom C++ libraryAlexandru Croitor2018-05-1610-0/+1121
A CMake project is included that builds two shared libraries: 1) libuniverse - a hypothetical C++ library for which bindings need to be created. 2) Universe - a Python module containing bindings to the above library. The example showcases the following concepts: * primitive type bindings (bool, std::string) * types with object and value semantics (pass by pointer VS pass by copy) * inheritance and overriding virtual methods * ownership of heap-allocated C++ objects * constructors with default parameters * general structure of CMakeLists.txt file for generating bindings Task-number: PYSIDE-597 Change-Id: I7b0f203e2844e815aa611af3de2b50a9aa9b5bfc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>