summaryrefslogtreecommitdiffstats
path: root/cmake/QtBaseGlobalTargets.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Make sure to install Qt3rdPartyLibraryConfig.cmake.inAlexandru Croitor2020-03-231-0/+1
| | | | | | | | | | Repos like qtshadertools need it when configuring their own bundled libraries. Amends 572c03eb7a583baf1f48e5144d2868e5588d292a Change-Id: I540e99d5bd2938299a10220a1a5e0d97091077b3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Introduce qt_configure_fileAlexandru Croitor2020-03-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has the same kind of signature as file(GENERATE) but creates the files at configure time rather than generation time. CMake provides a few ways to generate files file(WRITE) -> always overrides content configure_file() -> only overrides if content changes, creates file at configure time, can only take a file as input file(GENERATE) -> only overrides if content changes, creats file at generation time, can take a string or file as input Because dealing with an input file is a hassle (need to create one, make sure it's installed, make sure it's used correctly in the various build types like super-build, non-prefix-build, etc) people tend to use file(GENERATE) instead, which can take a string argument, and is thus easier to use. Unfortunately that introduces subtle bugs because the file is created at generation time, but there are existence checks which are done at configuration time. Thus qt_configure_file allows creation of files at configure time, without having to provide an input file. Underneath it uses configure_file(). Once CMake 3.18 is released, the implementation can be switched to use file(CONFIGURE). Change-Id: Ic8f8d88541ef0b25d01af143352c8c9ba390ad5f Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Provide script to configure and build one or more testsAlexandru Croitor2020-03-231-23/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch there were a few ways to build tests - Configure all tests as part of the repo build - Configure all tests as part of the repo build, but don't build tests by default (-DQT_NO_MAKE_TESTS=ON) - Configure all tests as a standalone project in a separate build dir using -QT_BUILD_STANDALONE_TESTS=ON All of the above incur some time overhead due to the necessity of configuring all tests. Sometimes you just want to build ONE test (or a few). To facilitate that use case, a new shell script called bin/qt-cmake-standalone-test(.bat) can now be used to configure and build one or more tests. The script takes one single argument pointing to the desired test project path and configures a generic template project that sets up all the necessary Qt CMake private API, afterwards calling add_subdirectory on the passed in project. Example $ path/to/qt/bin/qt-cmake-standalone-test ./tests/auto/gui/image/qicon or $ path/to/qt/bin/qt-cmake-standalone-test ./tests/auto/gui/image After that, simply run 'ninja && ctest' to build and run the test(s). This is the CMake equivalent of calling qmake on a test .pro file (or on a tests SUBDIRS .pro file) There are 3 details worth mentioning. Due to the add_subdirectory call, the built artifacts will not be in the top-level build dir, but rather in a nested build_dir. The script currently can't handle more than one argument (the path to the project), so you can't pass additional -DFoo=bar arguments. If a test uses a 3rd party library (like Threads::Threads) which was not a public dependency for any of the Qt modules, configuration will fail saying that the target was not found. Perhaps we should consider recording these packages when generating the StandaloneConfig.cmake files. Change-Id: Icde6ecb839341d34f341d9a19402c91196ed5aa0 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Remove APPLE prefix from platform namesTor Arne Vestbø2020-03-161-4/+4
| | | | | | | None of the other platforms have it. Change-Id: Ib448c2c03ba03f711b507ef391977c0e6aa7c192 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Fix naming when referring to Apple macOSTor Arne Vestbø2020-03-161-1/+1
| | | | | Change-Id: Iafb5e448d0d65d42f788464fc600594a5666f9af Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Add default Info.plist for macOS with some important keysTor Arne Vestbø2020-03-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | The default Info.plist shipped with CMake lacks an NSPrincipalClass entry, which is crucial for making macOS apps run in full resolution on retina screens. We make sure the file is only picked up on macOS, not iOS and friends, since those platforms require another principal class. If needed we can extract the value out as a CMake variable and use the same file for all Apple platforms. Doing so would assume all keys are single-platform only, so if that's not the case we need platform-specific files. We should probably extract the package type out as a variable too, so that the file can be used for both apps, plugins, and frameworks, but doing so requires setting up that variable somewhere based on the target type, which CMake doesn't allow in an easy way. The file itself is based on the file CMake ships, combined with keys inherited from Qt's existing plist templates for qmake, and adjusted to match what Xcode generates by default these days. Change-Id: I3f5109e5fff63cdbd109a99d4008948d4bd2102b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Install the QtBuildInternalsAndroid.cmake filleAlexandru Croitor2020-03-121-1/+5
| | | | | | | | | | It's needed when building qtdeclarative. Needs to be copy_or_install to support non-prefix builds as well. Change-Id: Ied59f6a1f8403be3721a0ad46f5a3b2f569028ca Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Propagate minimum required C++ standard to consumers of QtAlexandru Croitor2020-03-121-0/+4
| | | | | | | | | Aka the version of C++ that needs to be supported when compiling applications that use Qt headers (C++17 at the moment). Change-Id: I64dec297e8329f31b1d9864f216a95782049ed06 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Port the 'separate_debug_info' featureJoerg Bornemann2020-03-061-0/+2
| | | | | | | | | | | | | | | For this, we have to uninline the separate_debug_info configure test, because supporting the conversion of this in configurejson2cmake is not worth the hassle. Separate debug information can be turned on for a target by calling the function qt_enable_separate_debug_info. For Qt's shared libraries and tools separate debug information is generated if the 'separate_debug_info' feature is manually turned on. Change-Id: Ic2ffc15efef3794dc0aa42f3d853ef6d651a751c Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Handle conditions in third party find modules correctlyAlexandru Croitor2020-03-051-0/+1
| | | | | | | | | | | | | | | | | | | | | Previously the FindWrap modules checked for hardcoded features when deciding whether to use a bundled library or not. This proved not to work correctly because features were not available when the find modules were processed. Introduce a new CMake API call that needs to be manually called after an add_subdirectory call which declares a bundled library. The call will check for the existence of the bundled target, and will then set a cache variable QT_USE_BUNDLED_Bundled<TargetName>. The same variable is written into a FindWrapFooConfigExtra.cmake file which will be loaded by the appropriate FindWrap module. The module can that use that variable to decided whether to link against the bundled library or the system library. Change-Id: I75e9a4f4e14d88d4490916a79ad12f1ce57891e0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Allow building bundled 3rd party libraries in qtbaseAlexandru Croitor2020-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A few things are needed to accomplish that: - the python scripts do not ignore certain system_foo features anymore (it is a hardcoded list for now just to be safe) - configurejson2cmake now outputs qt_find_package(WrapSystemFoo) calls for bundled libraries (see below) - the harfbuzz .pro file is modified to accommodate pro2cmake not being able to correctly parse some conditional scopes - the freetype .pro file is modified to make sure linking of the library succeeds without duplicate symbol errors, which qmake doesn't encounter due to magical exclusion of cpp files that are included in other cpp files (presumably for include moc_foo.cpp support) - feature evaluation for Core, Gui, Network now happens in the qtbase/src directory, so that bundled libraries can be conditionally built - for each bundled library there are now two FindWrap scripts: - FindWrapSystemFoo which finds an installed library in the system - FindWrapFoo which either uses the system installed library or the built bundled one depending on a condition - projects that intend to use bundled libraries need to link against WrapFoo::WrapFoo instead of WrapSystemFoo::WrapSystemFoo targets (this is handled by pro2cmake). Unfortunately manually added qt_find_package(WrapFoo) calls might still be needed as is the case for WrapFreetype and others. - a new cmake/QtFindWrapHelper.cmake file is added that provides a macro to simplify creation of WrapFoo targets that link against a bundled or system library. The implementation is fairly ugly due to CMake macro constraints, but it was deemed better than copy-pasting a bunch of almost identical code across all FindWrapFoo.cmake files. - a qtzlib header-only module is now created when using bundled zlib, to provide public syncqt created headers for consumers that need them. These are projects that have 'QT_PRIVATE += zlib-private' in their .pro files (e.g. qtimageformats, qtlocation, qt3d, etc.) This is unfortunately needed due to QtNetwork using zlib types in its private C++ API. The change includes support for building the following bundled libraries: - zlib - libpng - libjpeg - Freetype - Harfbuzz-ng - PCRE2 The following 3rd party libraries are still using an old implementation within the CMake build system, and should be migrated to the new one in the near future: - double-conversion - Old harfbuzz The are a few libraries that are not yet ported: - system-sqlite - systemxcb - maybe others Among other things, this change allows building qtbase on Windows without requiring vcpkg. Task-number: QTBUG-82167 Change-Id: I35ecea0d832f66c1943c82e618de4a51440971a5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* CMake: Fix c++ standard config tests with MSVCAlexandru Croitor2020-02-181-0/+2
| | | | | | | | | | | | Need to pass additional -Zc:__cplusplus flag when using MSVC, so that the __cplusplus define has correct values. Additionally make the option be propagated to consumers of Qt via the public Platform target, which QtCore links against. Change-Id: Ie1283c25334b93f993529beb7fb32bdb001627f5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* Don't hardcode the include directory nameChristophe Giboudeaux2020-01-311-1/+1
| | | | | | | | | | | | Hardcoding "lib" caused build issues and wrong INTERFACE_INCLUDE_DIRECTORIES paths in generated CMake configuration files if INSTALL_INCLUDEDIR pointed to a different location. Contributes to QTBUG-81289 Change-Id: I3276ecbb4bf5df1c0b4c496c0287b4a69586d683 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't hardcode the binary directory nameChristophe Giboudeaux2020-01-311-4/+4
| | | | | | | | | | | INSTALL_BINDIR may point to a different location than "bin". In order to avoid errors when trying to install qtbase, "bin" is replaced with "INSTALL_BINDIR" where necessary. Contributes to QTBUG-81289 Change-Id: I1d4f9fb2617547c9b0e44d6690caebb2b6768e2f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add INSTALL_MKSPECSDIR to the install locationsChristophe Giboudeaux2020-01-311-2/+2
| | | | | | | | | | | | | Linux distributions may want to install mkspecs files into a different subdir in order to make Qt6 co-installable with older versions. Contributes to QTBUG-81289 Change-Id: Ie4a64370d742948d5ca4f2eaed6ea550d2676707 Reviewed-by: Qt CMake Build Bot Reviewed-by: Christophe Giboudeaux <christophe@krop.fr> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix CMAKE_BUILD_TYPE to be a cache variable in QtBuildInternalsExtraAlexandru Croitor2020-01-291-7/+1
| | | | | | | | | | Rather than pass the build type in the wrapper, make sure the build type is a cache var, so it gets picked up when building other repos. This reverts commit f72ca4cf853619efb99ab08da803536392229d37. Change-Id: I5d91ab66249b6c40c5e548b0eec0e467ba0f2ebc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Forward CMAKE_BUILD_TYPE, if available, in qt-cmakeLeander Beernaert2020-01-291-1/+7
| | | | | Change-Id: I299e16cfc084b3fc009e806902e26121ebdd454b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add initial support for CMake "Ninja Multi-Config" generatorAlexandru Croitor2020-01-271-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows doing debug_and_release builds with Ninja on all platforms. The "Ninja Multi-Config generator" is available starting with CMake 3.17. Desired configurations can be set via CMAKE_CONFIGURATION_TYPES. Possible values: "Release, Debug, RelWithDebInfo, MinRelSize". For example -DCMAKE_CONFIGURATION_TYPES="Release;Debug". The first configuration is the 'default' configuration which is built when calling ninja with no arguments. To build all targets of a certain configuration use "ninja all:Release" or "ninja all:Debug". To build all targets in all configurations use "ninja all:all". Note that the first configuration influences which configuration of tools will be used when building the libraries for all configurations. In simple terms, when configured with -DCMAKE_CONFIGURATION_TYPES="Release;Debug" the release version of moc is used by AUTOMOC. When configured with -DCMAKE_CONFIGURATION_TYPES="Debug;Release" the debug version of moc is used by AUTOMOC. Framework builds and Ninja Multi-Config don't currently work together due to multiple bugs in CMake, which ends up generating an invalid ninja file with duplicate rules. There are also issues with placement of the debug artifacts. This will be handled in a follow up patch after CMake is fixed. Task-number: QTBUG-76899 Change-Id: If224adc0b71b7d1d6606738101536146aa866cd7 Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Implement qtbase fixes for superbuildsJean-Michaël Celerier2020-01-081-6/+2
| | | | | | Change-Id: I0d3445cf0740e3925fa9342dac4d07892518afe5 Reviewed-by: Qt CMake Build Bot Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Make sure to install QtModuleToolsVersionlessTargets.cmake.inAlexandru Croitor2019-12-061-0/+1
| | | | | | | | | | | | Amends 04d895681adab24829be44c392534bcbe9d6c106 Task-number: QTBUG-74137 Task-number: QTBUG-80477 Task-number: QTBUG-75984 Change-Id: I617c2abf421bc1378545e5a36fd44533131ef471 Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add initial support for cross-building to iOSAlexandru Croitor2019-12-031-2/+29
| | | | | | | | | | | | | | | | | | | | | | Tested locally with the following configurations: - iOS device builds (arm64) - iOS simulator builds (x86_64) - iOS simulator_and_device builds (fat arm64 and x86_64 archives) All iOS builds currently require a custom vcpkg fork which contains fixes for building the required 3rd party libraries. qtsvg, qtdeclarative, qtgraphicaleffects and qtquickcontrols2 have also been tested to build successfully. simulator_and_device builds are also supported, but require an umerged patch in upstream CMake as well as further patches to vcpkg. Task-number: QTBUG-75576 Change-Id: Icd29913fbbd52a60e07ea5253fd9c7af7f8ce44c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* Make sure to install QtStandaloneTestsConfig.cmake.inAlexandru Croitor2019-11-121-0/+1
| | | | | | | | | Otherwise leaf modules fail to configure. Amends de3a806def4b9a754825a2233c9d4952a9b2d0eb Change-Id: Ie304c0021ada9911044abdb7e460b8da8e986a8f Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Write out a module description fileTobias Hunger2019-10-211-0/+1
| | | | | | | | | Write out a file with some JSON data to describe a module. This file contains information on how that module has been built. Change-Id: I8a604692663cbb7b76b96b97124130e30b822e4b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Prospective fix for linking problems of qtdeclarative in the CISimon Hausmann2019-09-031-5/+5
| | | | | | | | | | | In the ICC configuration we can't build the qtbase libraries with ICC and qtdeclarative with gcc, mixing won't work well. On Windows we've covered this compiler mixing scenario using our toolchain file, but the ICC case makes it clear that we have to be consistent about caching the compiler in the toolchain file across platforms. Change-Id: Iad2005ab00655f902e5f5cea2f0563d790d8aa93 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Extract add_qt_resource into reusable componentsLeander Beernaert2019-08-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | This patch moves all of the underlying code for add_qt_resource into a common reusable snippet for both the Qt build and user projects. For users, the new API is available under QT5_ADD_RESOURCES. If outfiles is a CMAKE target we will use the new API, otherwise we will fall back to the old behavior. This patch also adds EXTRA_CMAKE_FILES and EXTRA_CMAKE_INCLUDES to add_qt_module so that module specific cmake files can be installed and loaded by the module's config.cmake. The code will be installed under CMAKE_BINARY_DIR/Qt{}CoreResource.cmake and is injected into Qt{}Core_Config.cmake via the extra cmake includes passed into add_qt_module. To make sure it still works with QtBuild, we do the actual generation of the file from QtBaseGlobalTargets and include the generated file there as well. Change-Id: I85fefaa11dde01a6790d23c62d6a64cd157e2617 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix Android build for other Qt modulesLeander Beernaert2019-08-161-0/+4
| | | | | | | Install missing QtBuildInternalsAndroid to installation path. Change-Id: I6141ff72b57a6445f1718bc17d64a7ed59a91620 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Install QtPlugins.cmake.inLeander Beernaert2019-08-121-0/+1
| | | | | | | Added rule to install missing QtPlugins.cmake.in. Change-Id: I485dadd56ee2dd435406d97399b32dc6390cebff Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix toolchain path when doing non-prefix buildsAlexandru Croitor2019-07-031-0/+7
| | | | | | | | | | | Previously the cmake install prefix was added twice during a non-prefix build, which evaluated to an incorrect path. Set another absolute dir variable, and use that instead. Change-Id: I73099510dadc8f401d5a763f21840c9671686c10 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Add auto detection routines for androidLeander Beernaert2019-06-271-0/+4
| | | | | | | | | | Add QtAutoDectect cmake which has routines to handle the vcpkg detection as well as set up some android configuration parameters. The latter will contribute towards keeping the cmake configuration commands shorter when targeting android. Change-Id: I721291c8dce39b5c298565a46867ddcab2df90e8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Prospective fix for using qt-cmake when %PATH% changes and using NinjaSimon Hausmann2019-06-261-0/+5
| | | | | | | | | Mixing compilers won't work well on Windows, so if qtbase is built using cl.exe and Ninja and then later cmake is called on another module and gcc is found in %PATH%, then cmake will prefer that. Let's avoid that. Change-Id: I8294482939efa6a16e0a4df8df3aeef8243c3657 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix osx deployment target and sysroot propagation in the qt toolchainSimon Hausmann2019-06-261-0/+10
| | | | | | | | | We need to save them in the toolchain file, otherwise we can't compile anything :) Change-Id: Ic5c53524fa4aa05d0b3229c2905dff92ca437ec1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Add windows batch file for convenient cmake invocation with Qt toolchain fileSimon Hausmann2019-06-251-0/+3
| | | | | | | | | Similar to the shell script, this makes it easier to invoke cmake by just extending your PATH. Change-Id: I1f83e93c507032f6ecf4838c11d62f49f4d93ed6 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix vcpkg default target triplet setting in the qt toolchain fileSimon Hausmann2019-06-241-1/+1
| | | | | | | Due to scoping this variable needs to be written into the cache. Change-Id: I2704fe9ac138210571e0b7acada5eb5c65e265af Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Generate a toolchain and convenience cmake wrapperSimon Hausmann2019-06-241-0/+28
| | | | | | | | | | | | | | | | | This gets us a step into the direction of convenience that qmake offered: * QtBase is configured with a long command line (especially when cross-compiling) * Afterwards application developers (or other module builds) can just use qmake && make By generating a toolchain file we can capture vcpkg and toolchain chain-loading and a shell script can take care of providing the prefix path. Change-Id: Ided81f5432cab862306f2bea86cfe8e56adf71b0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add PlatformCommonInternal target and QT_NO_DEBUG definitionAlexandru Croitor2019-06-241-2/+8
| | | | | | | | | | | | | | All the other PlatformModuleInternal, PlatformPluginInternal, PlatformToolInternal target will depend on the common one. Also add the QT_NO_DEBUG definition when the build type is not Debug. This fixes the lookup of the Qt platform plugin on macOS, which uses a "_debug" prefix in the plugin name depending on if the QT_NO_DEBUG definition is present or not. This is the same as it is done in mkspecs/features/qt.prf. Change-Id: I82cf461d44b8a3b3c5dc2b2d9f25baa246fc1e4b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-06-141-2/+2
| | | | | | | | | | This changes many different CMake places to mention Qt6 instead of Qt5. Note that some old qt5 cmake config files in corelib are probably not needed anymore, but I still renamed and kept them for now. Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
* Revert "cmake: Make CMake superbuilds work"Alexandru Croitor2019-06-141-5/+5
| | | | | | | | | | | | | Builds fail on Windows, due to splitting on ':' on absolute file paths, when handling syncqt injections. Revert for now to get qt6 merge in faster. This reverts commit 7559d508d1993dd90a4939441eaf353d55462ae5. Change-Id: If139a8a1eb4ae7ccc8d7b835b12e83b03176e28b Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Qt CMake Build Bot
* cmake: Make CMake superbuilds workKevin Funk2019-06-141-5/+5
| | | | | | | | | | | | In case of a CMake superbuild, the actual install root in a non-prefix build is the top-level build directory (not $TOP_BUILDDIR/qtbase anymore). This is more in line how CMake lays out things by default. Task-number: QTBUG-75582 Change-Id: I4e1744b5c877508fedc33e237eec28cb7436010b Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove redundant installation of QtPlatformAndroid.cmakeSimon Hausmann2019-06-121-8/+0
| | | | | | | | It's already installed right where QtSetup.cmake is installed. Change-Id: Ie88363ae3878cda8f92aa44160333886f64565d8 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: Generate deployment-settings.jsonLeander Beernaert2019-06-121-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generate the android deployment settings json for android apk targets. QtPlatformAndroid is now also deployed as a public build dependency of QtCore. Some minor refactoring has been performed to the naming of variables and functions to better match the public facing apis. Extra settings for the file can be configured using the following target properties: set_target_properties(Core PROPERTIES QT_ANDROID_DEPLOYMENT_DEPENDENCIES "foo;bar" QT_ANDROID_EXTRA_LIBS "foo;bar" QT_ANDROID_EXTRA_PLUGINS "foo;bar" QT_ANDROID_PACKAGE_SOURCE_DIR "/foo/bar/" ) The file is generated using the function qt_android_generate_depoyment_settings(). We need to install the android template files and jar files during the android build as the androiddeployqt tool wont work if parts of it are split between the host install and the android install. Added QT_BUILD_QT variable to check whether we are building Qt from source. Finally, we also force the stdlib to shared via cmake configuration with -DANDROID_STL="c++_shared" Change-Id: I063c47e11749d56ba4c6f02101dbcc09e1b9fe87 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce Platform*Internal targetsAlbert Astals Cid2019-06-051-1/+4
| | | | | | | | | | Link to them from add_qt_module/plugin/tool This way we set the warnings_are_errors flags just once and also non-qtbase modules get them Change-Id: I2b65a81694aaebdd7c886249f217c11f79492bad Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: SDK SupportLeander Beernaert2019-06-051-0/+1
| | | | | | | | | | | | | | | Enable building androiddeployqt when performing host builds only. Added QtPlatformAndroid.cmake to locate Java and the setup the android SDK platform when building on android. Install the androiddeployqt support files when performing a host build. Added ANDROID_SDK_ROOT configuration variable for specifying the android sdk directory. Generating the deployment-settings.json will be done in another change. Change-Id: I1bf15315af4ed904d2fb1d22b0e8e834df32d6ed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow to build examples as standalone projectKevin Funk2019-06-051-0/+6
| | | | | | | | | | | | | | | | Create CMake config files which can be used from the very same CMake project. These CMake config files simply do not create any targets, controlled via the QT_NO_CREATE_TARGETS. This patch also allows to build qtbase.git:examples as a standalone project, against an already-built Qt. Ran this: ag -s "QT " examples -l -0 | xargs -0 -n 1 .../util/cmake/pro2cmake.py --is-example Task-number: QTBUG-74713 Change-Id: I44cce5a4048618b30f890c5b789592c227a8b47d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Install plugin related .cmake.in filesAlexandru Croitor2019-06-041-0/+2
| | | | | | | | | This fixes the build when building qtsvg, qtimageformats, etc. Amends 0900298d466e819dd6d8fd39c0be333dc09af189 Change-Id: Ie732ef6faa99e2ebe7e8da6ee2aa5fc0cf59d3f3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix linking QtGui on AndroidSimon Hausmann2019-06-041-2/+2
| | | | | | | | | | | | | Until we have some convenience in place, it is strictly necessary to set the NDK API level, otherwise the libraries from vcpkg are statically built against a newer libc headers than what we finally link against. This also means that we can remove the manual libc linkage again. Change-Id: If1f2eec4df5ed800ac6b060561edff89236891e9 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Android: Fix linker erros for liblog & libcLeander Beernaert2019-06-041-0/+8
| | | | | | | | | | | | For the android platform library add dependencies on liblog and libc for every Qt target. The libraries are shipped by default in the Android NDK so they will always be present. Change-Id: Ic4a13be32118710b11effabfb16e27bd2d10809f Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add basic support for compiling applications with qmakeSimon Hausmann2019-05-311-0/+2
| | | | | | | | | | | | | | | | | * Generate module .pri files * Generate qconfig.pri * Propagate MODULE_CONFIG from the .pro files This enables the basic use-case of simple application builds that for example use the moc. Omitted from the patch is support for private module configurations, prl files (should we do this?) and possibly more hidden gems that need to be implemented to for example support building Qt modules with qmake. Task-number: QTBUG-75666 Change-Id: Icbf0d9ccea4cd683e4c38340b9a2320bf7951d0d Reviewed-by: Qt CMake Build Bot Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Stop trying to create config forwarding headers for NO_MODULE targetsAlexandru Croitor2019-05-161-1/+1
| | | | | | | | | | | | | | | | | | | The GlobalConfig target is not an actual module, so there's no point in trying to create forwarding headers for GlobalConfig's qconfig.h within qt_feature_module_end. qconfig.h's forwarding header will be created implicitly while processing QtCore target's SYNCQT.INJECTIONS value, which is read from the headers.pri file generated by syncqt. This also fixes trying to create forwarding headers when processing the sqldrivers project. Amends 02a015375a639a4d27d19bbf435f20b725696768. Change-Id: Ifd70d8c3ebf881ffdcf90db8d5d3b23309bc8fed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Use the qt_build_repo() macros for building qtbase as wellAlexandru Croitor2019-05-151-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | To implement this, create a new Qt5BuildInternals package. All child Qt modules like qtsvg should use find_package(Qt5BuildInternals) or find_package(Qt5 COMPONENTS BuildInternals) in the their top level CMakeLists.txt. This will make the qt_build_repo() macros available. For qtbase we slightly cheat, and specify a CMAKE_PREFIX_PATH pointing to the source folder that contains the BuildInternals package. For the other modules we actually use a configured and installed package Config file. This change moves variables that used to be written into the QtCore Config file into the BuildInternals package. This way things that are relevant only for building additional Qt modules does not pollute the QtCore package. Task-number: QTBUG-75580 Change-Id: I5479adff2f7903c9c2862d28c05c7f485ce3e4eb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement developer / non-prefix buildsAlexandru Croitor2019-05-151-41/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A non-prefix build is a build where you don't have to run make install. To do a non-prefix build, pass -DFEATURE_developer_build=ON when invoking CMake on qtbase. Note that this of course also enables developer build features (private tests, etc). When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable will point to the qtbase build directory. Tests can be run without installing Qt (QPA plugins are picked up from the build dir). This patch stops installation of any files by forcing the make "install" target be a no-op. When invoking cmake on the qtsvg module (or any other module), the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build directory. The developer-build feature is propagated via the QtCore Config file, so that when building other modules, you don't have to specify it on the command line again. As a result of the change, all libraries, plugins, tools, include dirs, CMake Config files, CMake Targets files, Macro files, etc, will be placed in the qtbase build directory, mimicking the file layout of an installed Qt file layout. Only examples and tests are kept in the separate module build directories, which is equivalent to how qmake does it. The following global variables contain paths for the appropriate prefix or non prefix builds: QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR, QT_CONFIG_INSTALL_DIR. These should be used by developers when deciding where files should be placed. All usages of install() are replaced by qt_install(), which has some additional logic on how to handle associationg of CMake targets to export names. When installing files, some consideration should be taken if qt_copy_or_install() needs to be used instead of qt_install(), which takes care of copying files from the source dir to the build dir when doing non-prefix builds. Tested with qtbase and qtsvg, developer builds, non-developer builds and static developer builds on Windows, Linux and macOS. Task-number: QTBUG-75581 Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>