aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* Make quiet builds really quietAlexandru Croitor2018-12-071-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change does a couple of things: - Sets the distutils / setuptools --verbose option to 0 - Sets the distutils / setuptools --quiet option to 1 - The options above end up calling distutils.log.set_verbosity(0) - Passes the QUIET_BUILD cmake option from setup.py to every CMake invocation, when --quiet is passed to setup.py - Sets the CMAKE_INSTALL_MESSAGE variable to silence messages regarding installation of files - Sets the CMAKE_RULE_MESSAGES variable to disable progress report in makefiles when building each source file - Overrides the CMake message function, not to display STATUS / info / untyped messages (still displays warnings and errors) - Changes the build / install elapsed time messages to always be printed even in quiet mode - Reverts the previously introduced set_quiet function in utils, because log.set_verbosity() now takes care of silencing those messages As a result, there's a lot less clutter when doing a quiet build. Warnings, errors and shiboken output is still displayed. Change-Id: Ie05c593ce7dc0aa04554c2d2859ce655233ddb9f Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Allow building shiboken2 and PySide2 as separate wheelsAlexandru Croitor2018-10-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* shiboken: Search for Clang builtin-includes at runtimeFriedemann Kleint2018-06-231-40/+0
| | | | | | | | | | Replace the search executed at build time by CMake by a run time search in shiboken since the location at build time typically won't match any more for the deployment case. Task-number: PYSIDE-693 Change-Id: Ib15fbba5d8c3fecf30aaae7195b88a648a7ed0fe Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't pass -DFORCE_LIMITED_API=yes from setup.py unless asked forAlexandru Croitor2018-05-311-1/+1
| | | | | | | | | | | | | | | | | | | It was weird seeing "-DFORCE_LIMITED_API=yes" being passed from setup.py to CMake when "--limited-api" is not included on the command line, and then seeing "-DFORCE_LIMITED_API=yes" with Python 2 builds. It gives the impression that maybe it could work with Python 2. Instead, don't pass "FORCE_LIMITED_API=yes" from setup.py by default (but still pass it if it's present on the command line), and instead default to "yes" within the CMake project themselves. In the end nothing changes, limited API builds will still be default, but at least it's not as confusing to see the "-DFORCE_LIMITED_API=yes" lines for Python 2 builds in the CI log. Change-Id: I08c863394dd148d88bec324a6cab35459d75303a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix module names to contain correct limited api suffixAlexandru Croitor2018-05-311-42/+56
| | | | | | | | | | | This includes .abi3.so on Linux and macOS, and .pyd on Windows. Otherwise if you build with Python 3.6, and try to install the package on Python 3.5, none of the modules would be found on import. Change-Id: I56639da6319cfa06e23ae793d66099813074adf4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PEP 384-squash: Implement PEP 384Christian Tismer2018-05-301-15/+52
| | | | | | | | | | This is the condensed checkin of 18 commits which created the implementation of PEP 384. Task-number: PYSIDE-560 Change-Id: I834c659af4c2b55b268f8e8dc4cfa53f02502409 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix incorrect usage of findLlvmConfigAlexandru Croitor2018-05-251-2/+2
| | | | | | | | | The functions has been renamed due to PEP8 formatting. Amends 71249b93a5d12a320b44c608c05fb9d220788a18 Change-Id: I00206e1dda77f672d6883406e47debda19bc622f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Increase Python minimal accepted versionCristian Maureira-Fredes2018-05-111-2/+2
| | | | | | | | 2.6 -> 2.7 Task-number: PYSIDE-653 Change-Id: Id62717f12e17c50732c796d3d84686fd47597ab0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve libclang extra include headers detectionAlexandru Croitor2018-05-081-2/+21
| | | | | | | | | | | | | | On certain distros (e.g. ArchLinux) there may be additional files in the path where we GLOB for clang version include folders (e.g. /usr/lib/llvm/lib/clang/6.0.0 and /usr/lib/llvm/lib/clang/ccc-analyzer). Filter the files out, and only consider folders starting with a number (e.g. 6.0.0). Change-Id: I85052e45610090f399ec92200f7a666c4872f78d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Improve libclang detection on LinuxAlexandru Croitor2018-05-081-5/+32
| | | | | | | | | | | | | | | This change essentially allows usage of the distro-specific libclang libraries for building shiboken. This required changes to the name of the library that CMake looked for (looking at you Debian). The change also adds an additional compile test to check for the availability of the libclang headers which shiboken uses. This should prevent a failure at build time, and transform it into a nice error message at cmake configure time. Change-Id: I37e019fd5923379436a67d77f92c30efd77620d2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix CMake usage of utils.pyAlexandru Croitor2018-05-071-1/+1
| | | | | | | The file was moved, but the path was not adjusted. Change-Id: I80ea28e4238f9cf9d43db2f9e669d84d5eafaea6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Improve CMake clang detection logicAlexandru Croitor2018-04-201-1/+8
| | | | | | | | | | | | Before calling llvm_config, check that the path to llvm_config is non-empty. Otherwise exit early. Change-Id: Ibde88bbcc6a1c6324b2a0cbb1b62f894a7aae42c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix typo on shiboken cmake configurationCristian Maureira-Fredes2018-03-121-1/+1
| | | | | Change-Id: I3649f57ba75a38db373d3491b253507f60c9ee6f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Check for compatible Qt version when building PySide2Alexandru Croitor2018-03-061-1/+1
| | | | | | | | | Shiboken uses C++11 constructs like qAsConst, which necessitates the usage of a Qt version >= 5.7. Instead of showing weird compilation errors when building against Qt 5.6, print a nice error message. Change-Id: Iea4bd41dbe1d7d05e9b28bfa6654f68c6633cd74 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-03-051-19/+41
|\ | | | | | | Change-Id: I452d3a0a04e282b678879132ca1b3a272910ef04
| * Implement proper package versioningAlexandru Croitor2018-03-021-19/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change is inspired by / follows PEP 440 for handling version numbers and also takes into account the Qt versioning scheme. PySide2 as package name will stay as-is (not renamed to PySide5). Release versions would have the following pattern: PySide2 5.x.y (e.g. 5.6.3) Package (wheel) name would also contain the bundled Qt version, e.g.: PySide2-5.6.0-5.6.4-cp27-cp27m-macosx_10_7_intel.whl Pre-release versions would look like: PySide2 5.6.0a1, 5.6.0a2, 5.6.0b1, 5.6.0b2, 5.6.0rc1, etc. Development (snapshot) versions would look like: PySide2 5.6.0-dev123456789 (last part is timestamp of build time) All of the examples above comply with the PEP 440 rules. In the example above where the Qt version is specified as part of the wheel package name ("5.6.4"), the Qt version is not part of the package version itself, because it doesn't comply with PEP 440. But it does comply with wheel package names (PEP 427), and by that PEP's definitions, it will be the optional "build tag" part of the file name, which is preceded by the actual package version, and followed by the python version / abi tag. Implementation: This change defines two new python configuration files which will be the authoritative source for the shiboken and PySide2 libraries, as well as the final PySide2 package itself: sources/shiboken/shiboken_version.py sources/pyside2/pyside_version.py The pyside_version.py file will be the source of the final package version. The shiboken and PySide2 version should be modified in sync, when bumping the version of the package before a release. The reason for having both files instead of 1, is to make life easier for developers that might extract only shiboken from the repository. If at some point shiboken and PySide2 CMake projects get merged into one project, the duplicate version files would go away. The version files are parsed by CMake to correctly name the shared libraries (and SO versions), and they are also read by the setup.py script, to generate correct package metadata and a correct package (wheel) name. This change also removes the broken dist targets from PySide2's and shiboken's CMakelists files, which depended on some version suffix which was never set in setup.py. PEP440: https://www.python.org/dev/peps/pep-0440/ PEP427: https://www.python.org/dev/peps/pep-0427/ Change-Id: I3226460b1adf2555c8711fa2ba47c223b957cb44 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Add rudimentary support for address sanitizer buildsAlexandru Croitor2018-02-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a new setup.py option called --sanitize-address which will build all executables and shared libraries with address sanitizer enabled. The builds will only succeed on Linux and macOS machines that have new enough gcc / clang versions, so it is a "use at your own risk" build configuration. This change was necessitated by the random crashes that are sometimes observed on the CI machines, and due to valgrind not working properly on new macOS versions, using AddressSanitizer is the next best thing. Note that when running tests with address sanitizer builds, you might need to export a LD_PRELOAD / DYLD_INSERT_LIBRARIES environment variable pointing to the address sanitizer runtime library path, which will be provided by the crashed application. Change-Id: I93014002e5c5e94bcc808ba2fb830d60724cfb69 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-02-231-0/+1
|\| | | | | | | Change-Id: I5d1a4734e8f44785898ba62beaa0bdd2004fca22
| * Don't copy duplicate libraries on package installationAlexandru Croitor2018-02-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes sure to resolve symlinks and copy only one file for every dynamic shared library used (vs 3 before -> 2 symlinks + 1 actual library). This avoids duplicate files, as well as saves space when creating wheel (e.g. no 3 copies of standalone WebEngine library). This filtering happens copying from CMake install dir into pyside_package_dir (the symlinks are still present in the CMake dir, but that shouldn't harm anybody, and might be useful for users of shiboken only for example). Task-number: PYSIDE-495 Change-Id: I0fe454e16c6b254a8682aa7b1c702ec01a3064f0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-01-191-2/+12
|\| | | | | | | Change-Id: I5f2e1660a27efafa445592898db4dfe3250306e0
| * Do not link shared libraries against the python shared library on UnixAlexandru Croitor2018-01-151-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to link against the python shared library (or static library) on Linux / macOS because the python symbols will already be loaded by the dynamic linker, by the time when a PySide2 module is imported. This is especially relevant on Debian distributions, which ship a statically built python interpreter, as well as a python shared library (which is not used by the interpreter). The python shared library package is intended for native application that want to embed a Python interpreter inside the application. So far PySide2 would have linked against the python shared library, which means that on Debian distributions when running a PySide2 example, the executable would load two versions of the same python symbols (one from the static interpreter, and one from the shared library), and this might cause issues. On Windows we still need to link against the python.lib import library, because otherwise the python symbols would not be resolved. Task-number: PYSIDE-522 Change-Id: I4483ded96461c04f8e7a17d39068d07f772a973c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Use latest version of llvm-configFriedemann Kleint2017-11-031-4/+23
| | | | | | | | | | | | | | | | | | | | When falling back to llvm-config, try to determine the most recent version by using a glob pattern to find the executable (llvm-config-3.8/3.9...) and checking the version it reports. Change-Id: I13b5aff09a6a2f8b95def0041176c1487749be1a Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Replace _ARCH_ by 64/32bit in LLVM_INSTALL_DIRFriedemann Kleint2017-09-221-0/+17
| | | | | | | | | | | | Task-number: PYSIDE-431 Change-Id: I6d4ea037ab0c524f305ed72f95745deb410b8971 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Bump minimum required CMake version to 3.1Alexandru Croitor2017-07-271-2/+2
| | | | | | | | | | | | | | | | | | Shiboken uses C++11 features, and thus the CMAKE_CXX_STANDARD setting needs to be set in the CMakeLists.txt file. The setting was introduced in CMake version 3.1.0. Thus we bump the minimum required version. Change-Id: Ic93dc76440930a19945bbd95461fc5859f2df0d0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Force usage of C++11 for shibokenAlexandru Croitor2017-07-261-0/+4
| | | | | | | | | | | | | | | | | | | | Previously we requested C++11 support from the compiler, but if the compiler does not support the standard, CMake would silently fall back to using C++08. Force usage of C++11, and cancel the build if the standard is not supported. Change-Id: I963a3f3d0b7dffb85a822c7aeb5f6979c0bbc189 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Fix building on openSuSE and Ubuntu 16.04 CI machinesAlexandru Croitor2017-07-241-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously all the GCC header paths were explicitly passed to libclang, which caused redefinition errors of builtin functions or intrisics (like __rdtsc). Instead of passing the include paths explicitly, we rely on libclang itself recognizing that there are GCC paths in the default search locations. Also we need to pass the libclang builtin headers location, because it is not able to find them by itself. Usually the search location for these headers is to get the executable path location (aka the clang++ binary) and navigate to ../lib/clang/VERSION/include relative to that binary. But because the shared library is used instead of the binary, we need to explicitly pass that header location via the -isystem flag. Task-number: PYSIDE-513 Change-Id: I7c1127d85c0cea4c063c5c2a3548a1eef5eadaf3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-07-141-75/+98
|\| | | | | | | Change-Id: I1dd2958b252b82e8699e8d2212afdce0086a16d2
| * Fix Windows module extensions and tests to work with --debug buildAlexandru Croitor2017-07-121-24/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Improve suffix names for shared libraries and cmake config filesAlexandru Croitor2017-07-121-73/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change decouples the naming of general shared libraries, python module extensions, and cmake configuration files. All of them are now computed depending on the python version and python build configuration, and can also be manually set via CMake variables. The module extensions names now use the most detailed 'import' prefix, which usually informs whether a debug or release python was used, or the Python ABI flags (for Python >= 3.2). When a debug Python interpreter is used for building PySide2, the preprocessor define Py_Debug is now correctly propagated to PySide2 sources, which fixes previous crashes in debug builds. This affects only Linux and macOS builds. There is a subsequent change for making it work for Windows builds. All in all, this now allows proper mixing of debug / release versions of the Python interpreter with debug / release versions of PySide2 on Linux and macOS. Task-number: PYSIDE-508 Change-Id: I88a05c3ada0fb32c7c29bdb86d7a2c15acc963b8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * move everying into sources/shiboken2Oswald Buddenhagen2017-05-221-0/+244
| | | | | | 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.
* Shiboken: Set C++ 11 globallyFriedemann Kleint2017-06-281-0/+1
| | | | | Change-Id: I17634ebc245cae87819af16d79704326905e5783 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* move everying into sources/shiboken2 (5.9 edition)Oswald Buddenhagen2017-05-221-0/+285
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.