summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix linking QtGui on AndroidSimon Hausmann2019-06-042-3/+3
| | | | | | | | | | | | | 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
* CMake: Treat Qt plugins as MODULE librariesCristian Adam2019-06-041-1/+1
| | | | | | | | | CMake will complain if you try to use a plugin in target_link_libraries, and it won't produce import libraries on windows, or use .so.number on Linux. Change-Id: I6f0cf8267b3c0e6e5c888703596afe59b3a39141 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Install plugins on WindowsCristian Adam2019-06-041-0/+1
| | | | | | | | The plugin dll files were missing from install_dir/plugins/ Change-Id: I68655faf949e4b8fcab153c6c9b8ee14d3ad8ecc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Android: Use lld as default linker for Qt ModulesLeander Beernaert2019-06-041-0/+6
| | | | | | | | | We can't use the gold linker with the android NDK, which is the default option. Using the gold linker results in linker crashes. QMake builds also disables the gold linker. Change-Id: I73de93150b160b4411715007bc7e40238b96d400 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix build with clang 8.0Simon Hausmann2019-06-041-1/+3
| | | | | | | | | | | | | When qt_parse_version_string tries to parse the compiler version into separate fields, it tries to accommodate for different number of digits separate by dots by checking the length of the list as it is mutated. Unfortunately the length variable is not a live variable, so after removing an entry from the list we must change the length variable manually. Change-Id: Ieaeb091581484e8c723fbb467697f73036e64ec9 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Install dlls on WindowsCristian Adam2019-06-041-0/+1
| | | | | | | Dlls were missing from the install_dir/bin directory. Change-Id: I0b5ef685b779c91969bbfa877f226be2060f6e56 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix qFindTestData with cmake and ninja generatorSimon Hausmann2019-06-041-1/+4
| | | | | | | | | | | | | | | | | | In order for test lib to locate the file requested via QFINDTESTDATA, it needs the build directory of the test (for example $builddir/tests/auto/foo/bar) and __FILE__ expanding to a path to the source relative to this build directory. With ninja, __FILE__ is a path that is always relative to the top-level build directory, not the per-test case one. Therefore the path resolution in testlib fails. To accommodate this, add_qt_test() now always sets QT_TESTCASE_BUILDDIR as well as the newly introduced QT_TESTCASE_SOURCEDIR, which, as an absolute path, removes the need to use __FILE__. Change-Id: I16c2b0001e38162e6da9fdb1a61f4f8ce634fe46 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* CMake: Allow build with MinGW and Hunter 3rd party packagesCristian Adam2019-06-042-1/+14
| | | | | | | | | | | Hunter has recently added aliased target names that conform with upstream CMake find module target names. Extended the WrapFreetype to work with Hunter's freetype (lowercase) package name. Change-Id: I0e25f342c6930658f07f05d2e6a58cf94d2d168d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* 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>
* cmake: register plug-ins, create dependencies fileJean-Michaël Celerier2019-06-048-162/+424
| | | | | | | | This commit introduces infrastructure work to allow static builds of Qt to handle importing of plug-ins. Change-Id: Ife0ca3ca7276ea8ec96fe0eb6adf934fad7620ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Fix xcb buildAlbert Astals Cid2019-06-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Need qt_find_package(X11_XCB) in src/gui/configure.cmake since we're using it in the file qt_feature("xcb_xlib" PRIVATE LABEL "XCB Xlib" CONDITION QT_FEATURE_xlib AND X11_XCB_FOUND ) Need qt_find_package(XRender PROVIDED_TARGETS PkgConfig::xrender) in src/plugins/platforms/xcb/CMakeLists.tx since we're using it in the file extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender PUBLIC_LIBRARIES PkgConfig::xrender ) Use capital XRender in pkgconfig to be more consistent on how XRender is called everywhere else Change-Id: I403ead2cc123b08f741c5142f20db88987657ba8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add private define _USE_MATH_DEFINES on Windows for every moduleAlexandru Croitor2019-06-041-0/+6
| | | | | | | | | | | It's needed when building QtQml on Windows, otherwise compilation fails. Add it as a private define for every module being built, as it is done in qt_module.prf. Change-Id: I1e322d1da15adea8b3f037a722b3260a552dfb62 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Handle a few more condition types in pro2cmakeAlexandru Croitor2019-06-041-0/+39
| | | | | | | | | | | | | | | | qtdeclarative has a few conditions that check the gcc version via variables like QT_GCC_MAJOR_VERSION. To handle that, parse the CMake compiler version using qt_parse_version_string() into separate variables like QT_COMPILER_VERSION_MAJOR, QT_COMPILER_VERSION_MINOR and QT_COMPILER_VERSION_PATCH. We can then map the conditions appropriately. Also, handle isEqual(foo, bar), which is equivalent equals(foo,bar). Change-Id: I74575c733b44f1f42451e00038b3f113fd353915 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QtConfig.cmake.in: Fix typoKevin Funk2019-06-041-1/+1
| | | | | | | | | | This var needs the cmake namespace as prefix. Follow-up commit of c5e2838b642d2a50d951efe7b582d9261d55dfb7 Change-Id: I595306301313b1ff911134776480d28b3194bcf8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Add some basic instructions for cross-compiling for AndroidSimon Hausmann2019-06-031-0/+15
| | | | | | | Change-Id: I0113a7b1e4e3b4d2fc7f93f9809d08fcaf4715d7 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix Android buildSimon Hausmann2019-06-031-2/+0
| | | | | | | | | | | | | Do not set ANDROID_EMBEDDED unconditionally, as that for now is the least likely configuration and it won't compile when the sysroot is real Android. If this gets revived, then it can be done by setting ANDROID_EMBEDDED in the cache file directly via the cmake command line. Change-Id: Ic1e1731f981414bd90b89fe91eaf0543a87d8c88 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Stop the flood of warnings due to qt_find_package() usageAlexandru Croitor2019-06-031-4/+0
| | | | | | | | | | | | | | The warning used to be a fatal error, until we found out that certain packages might provide optional targets, or provide one target out of a possible set. Until we figure out a better way to deal with that, remove the barrage of warnings while configuring. Change-Id: Iacf93a997a8f87f81167ac7c4cc991212e7fca5d Reviewed-by: Qt CMake Build Bot Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Fix cmake generate step when cross-compilation against AndroidSimon Hausmann2019-06-034-0/+16
| | | | | | | | | | | | | | We have find module wrappers for various system libs that use FindPkgConfig. The _FOUND variable will be set to 1 if pkg-config --exists returned true, but the imported target will not be created when for example the provided library paths or header include paths are outside of the sysroot - a good sanity check by cmake. We require the targets for use though, so therefore we must unset the _FOUND variable if we can't locate the targets. Change-Id: Ia0dea657684a1847148664521265c42585890645 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve finding of sqlite with vcpkgSimon Hausmann2019-06-031-0/+18
| | | | | | | | | | | | | | | | | | | | We use qt_find_package(SQLite3 PROVIDED_TARGETS SQLite::SQLite3) which intends to find cmake's FindSQLite3.cmake and expects the existence of the corresponding target. However qt_find_package first tries to call find_package in config mode, which does not interact well with vcpkg's sqlite, where sqlite3-config.cmake is provided to support multi-config targets. So that call will appear to succeed, yet the expected targets are not there of course. Therefore this patch adds a sanity check for the target existence and allows for a fallback to the module mode for find_package, in order to find CMake's FindSQLite3.cmake. Change-Id: I660f26c38369c3504df1c590e9d3a51ff1f65c6c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add build type (debug) and static vs dynamic to CONFIG in qconfig.priAlexandru Croitor2019-05-311-1/+14
| | | | | | | | | | Also fix the QT_BUILD_SHARED_LIBS usage. While building qtbase, it is assigned later than the call for qt_generate_global_config_pri_file(), so it used always choose static. Make sure to check for BUILD_SHARED_LIBS as well. Change-Id: I66f03e5adacc89646147fc96154bee8002b2b9cc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve qconfig.cpp generationAlexandru Croitor2019-05-311-8/+65
| | | | | | | | | | | | | | | | | | We used to copy a qconfig.cpp.in file verbatim. Add some plumbing to actually compute the strings and their lengths as it is done in qtbase/configure.pri. Also make sure to replace the hardcoded linux mkspec with one that is automatically determined. Of course both the detection of the mkspec, and the hardcoded strings for include, lib, etc. should be fixed in the future. This is a stepping stone to allow building a Qt application using the qmake built by CMake. Change-Id: I2e6754f44b20b09b09d14fd85785d56288e6517b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add architecture and abi to generated qconfig.priSimon Hausmann2019-05-311-1/+3
| | | | | | | Task-number: QTBUG-75666 Change-Id: If2933005038557c2b5041da6bd02c5890ac786ef Reviewed-by: Qt CMake Build Bot Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Add basic support for compiling applications with qmakeSimon Hausmann2019-05-312-1/+95
| | | | | | | | | | | | | | | | | * 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>
* Fix Android buildSimon Hausmann2019-05-291-0/+6
| | | | | | | Make sure that we can qplatformdefs.h. Change-Id: I781fe77d1332ab97b8711e25cc819862ccf28fd0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix linker flag detection on AndroidSimon Hausmann2019-05-291-2/+2
| | | | | | | | Since LINUX is not set when targeting Android, we must extend these conditions manually. Change-Id: Ie78167d452e0806bfa64773c1e311a99f4a28f8c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix architecture detection when targeting plain armSimon Hausmann2019-05-291-2/+3
| | | | | | | | | We record extra CPU features such as neon, etc. in the sub-architecture field, which may very well be empty. Allow for that and avoid cmake warnings about indexed string access beyond the string boundaries. Change-Id: I63e61c6427d156180039b8ac6f5b0f5f55c36ee8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Optionally include ${repo}Setup.cmake file in qt_build_repo_beginAlexandru Croitor2019-05-281-0/+3
| | | | | | | | | | This is meant to keep repo specific functions and macros that should not pollute QtSetup.cmake. For example QtDeclarativeSetup.cmake will automatically be included when building qtdeclarative. Change-Id: I4d26cbb1a7ffafb153a888fc918af337000d5e41 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Fix syncqt call and injected file forwarding and add comments about itAlexandru Croitor2019-05-281-7/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The location of the forwarding headers when not yet installed, depends on whether we do a prefix or non prefix build. In a prefix build the /include folder should be in the current repo build dir. In a non prefix build, it should be under qtbase/include. But the actual generated files to which the forwarding headers point, are always in the current repo build directory. Also syncqt needs to know both the current repo build directory specified by -builddir, and the output directory specified by -outdir. In a prefix build, both are the same. In a non-prefix build, builddir should be the current repo build dir, and outddir should be qtbase's build dir. Also for non-qtbase repo build directories (like declarative), examples need to have the current_repo_build_dir/include directory as an include path, so that framework style includes like #include <QtQml/QQmlEngine> work correctly. Take care of all that, and add a bunch of comments explaining the whole injected / generated headers interaction. Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix qt_build_repo to be more robustAlexandru Croitor2019-05-281-5/+4
| | | | | | | | | Check for the existence of CMakeLists.txt files before trying to call add_subdirectory on examples, tests and src folders. Change-Id: I7be76de5f7520c1dd181c610fd1dc2200ac74672 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Add some qtdeclarative related functions to QtBuildAlexandru Croitor2019-05-281-0/+49
| | | | | | | | | | QtQml uses QLALR to generate a grammar, but the qmake qlalr feature seems to be a general one, so the corresponding CMake implementations are kept in qtbase for now. Change-Id: Ibe916878b18155ddc5bb08793dd2075ebfa8f282 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Enable export of compile commands databaseSimon Hausmann2019-05-271-0/+5
| | | | | | | | | | For developer builds, enable the compile commands database by default. This allows Qt developers to use tools that utilize these (such as clang-tidy, etc.) without any extra setup. Change-Id: I79d70ef7dbe7c59864e93593c75f9ff6cd67c2ce Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Fix static zstd linkageSimon Hausmann2019-05-242-2/+2
| | | | | | | | | Upstream's cmake build system installs libzstd_static for static builds, so look for that as well. Now we can also recommend installing it via vcpkg. Change-Id: I0ba4c45ecd90bf7b1c9f1e5f84a440caa976a23c Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Update vcpkg instructionsSimon Hausmann2019-05-241-21/+5
| | | | | | | | | Let's recommend vcpkg only on Windows for now. That's best maintained and works best there. Change-Id: Ied06b6a3cb26d9e56d3f525c1d5a410223754fba Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Change the default enabled AUTOGEN tools list to contain only mocAlexandru Croitor2019-05-221-36/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch we enabled AUTOMOC, AUTORCC, AUTOUIC for all targets that did not opt out. Aside from being wasteful from a performance point of view, this also caused issues when trying to build qtimageformats which does not depend on Widgets which is the package that exposes uic. To avoid this, enable only AUTOMOC for all targets by default, and UIC and RCC can be opted in via the ENABLE_AUTOGEN_TOOLS option. To facilitate this some refactoring had to be done, like moving some common setup for all autogen tools into a separate call, and making sure that extend_target understands the autogen options, because some ui files are only added conditionally. Also the conversion script has been adapted to output the ENABLE_AUTOGEN_TOOLS option whenever a .pro file contains at least one FORMS += foo assignment. Note that we don't really use AUTORCC while building Qt, so nothing opts into that at the moment. Task-number: QTBUG-75875 Change-Id: I889c4980e9fb1b74ba361abed4044737f8842ea4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Reset main_module_tool_deps in QtPostProcessAlexandru Croitor2019-05-221-0/+1
| | | | | | | | | | | The variable was not reset when interating through all the Qt targets, which resulted in QtTest wronlgy depending on QtWidgetTools. Task-number: QTBUG-75875 Change-Id: I24da495fa53e9163992a1ed53f5cd7e1c6da5e51 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Allow building the tests directory as a standalone CMake projectAlexandru Croitor2019-05-223-10/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment, Coin builds tests as a separate qmake invocation against an installed Qt. We need to support the same with CMake. Change the tests subdirectory to be a standalone CMake project when CMake does not detect an existing QtTest target while processing the subdirectory. If the target exists, it means we are building the whole repo, if the target does not exist, we need to call find_package to find the installed Qt. Refactor and move around a few things to make standalone tests build successfully: - add a new macro to set up paths to find QtSetup - add a new macro to find all macOS frameworks - add a new macro to set up building tests - add a new macro that actually builds the tests - export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals Config file - export the CMAKE_BUILD_TYPE value, because a test project doesn't have a .git subdir and thus defaults to be built in Release mode, even though qtbase might have been built in Debug, so to avoid the mixing, the propagate the build type - stop overriding INSTALL_CMAKE_NAMESPACE and QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because the tests project doesn't specify a major version, and if we override the values, the moc / uic targets don't get the correct major version prefix and configuration fails Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675 Fixes: QTBUG-75090 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Build and use double-conversion library shipped by Qt when neededAlexandru Croitor2019-05-221-5/+15
| | | | | | | | | | | | | | | | Some Linux distros might not have a double-conversion library. Because it is such an essential library for QtCore, compile and use the the copy of the library bundled with Qt. Also change library name to be a proper target with double colons, so that in case the library is not found for some reason, the CMake configure step would fail, instead of failing at link time. Task-number: QTBUG-74133 Change-Id: I9f3b4298ae6e952891a7a89541d46878176bf1ce Fixes: QTBUG-75891 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Avoid accidental clash with .qrc files that are checked inSimon Hausmann2019-05-211-1/+1
| | | | | | | | Add a prefix for generated .qrc files so for in-source builds we don't end up overwriting htem. Change-Id: I8eef582479eb45d67585f6aab87b288393bbadb5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Simplify top-level CMakeLists.txt for modulesSimon Hausmann2019-05-211-0/+20
| | | | | | | | | | Implement some aspects of qt_parts.prf to simplify the top-level CMakeLists.txt for repositories that follow the common qt structure (src, tools, tests, examples). Change-Id: Ia35f4e9207e92c1cf0406353561b0cc52dcb0e59 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Automatically install repo specific cmake find modulesAlexandru Croitor2019-05-201-0/+15
| | | | | | | | | | | | | | Some qt modules need to find 3rd party packages for which there are no Config files. We need to write custom CMake Find modules to find those packages. These find modules need to be installed so that they are used when a user consumes the Qt packages. Automatically include and install these find modules if they exist, as part of qt_build_repo_end(). Change-Id: I14aad35ed2999cac8bdda65ca4aeaf74d04fdb71 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Propagate QT_CMAKE_EXPORT_NAMESPACE via QtCore packageAlexandru Croitor2019-05-172-0/+14
| | | | | | | | | | | | | | | | QT_CMAKE_EXPORT_NAMESPACE is used by the Qt packages to make features available to the consuming CMake project. The value was moved to the BuildInternals Config file, but that's wrong because consuming applications not including the BuildInternals component would fail to use any other Qt package. Move QT_CMAKE_EXPORT_NAMESPACE to be propagated with QtCore package again. Amends 9542e78525b422159406d8fa63e30dcd0f926411. Change-Id: I9841ac8c2828b00c0111d59e8976c889554e0ce1 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Copy feature properties from GlobalConfig to Core targetAlexandru Croitor2019-05-171-0/+25
| | | | | | | | | | | | | | | Current lates CMake has a limitation that it does not allow exporting custom properties from INTERFACE libraries. GlobalConfig is such a library, which means that so far all the global features were not actually exported. Copy the feature property values from GlobalConfig to Core. Because Core is an actual shared library, it keeps the custom properties when exported, and thus Core feature properties will contain the sum of Core and GlobalConfig feature values. Change-Id: Idde305cbaf9ab85ecfbe29522dcbac1c44022b17 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Stop trying to create config forwarding headers for NO_MODULE targetsAlexandru Croitor2019-05-162-10/+14
| | | | | | | | | | | | | | | | | | | 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>
* Save and set the CMAKE_INSTALL_PREFIX in BuildInternal's Config fileAlexandru Croitor2019-05-152-2/+8
| | | | | | | | | | | | | | Once qtbase is built and installed, save the CMAKE_INSTALL_PREFIX that was used during the build, and set it when a consumer calls find_package(Qt5BuildInternals). This fixes a bug where syncqt can not be found when building qtsvg, while the developer specifies CMAKE_PREFIX_PATH to find the Qt packages, but does not set the CMAKE_INSTALL_PREFIX. Task-number: QTBUG-75544 Change-Id: I03fd23ba418af5115105610f3f9ed92664562945 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use the qt_build_repo() macros for building qtbase as wellAlexandru Croitor2019-05-155-23/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Encapsulate commands for building other repos into two macrosAlexandru Croitor2019-05-152-5/+13
| | | | | | | | | | | | | | | | | | | Currently to build qtsvg we have some copy-pasted code to set up the paths for QtSetup and QtPostProcess to be found. To make it cleaner, introduce two new macros called qt_build_repo_begin and qt_build_repo_end(). The first one should be called in a child repo like qtsvg, right after a find_package(Qt5) call, and the second one at the end of the repo top-level CMakeLists.txt file. In order for the macros to work, extract some of the variables which were set in Qt5Config into Qt5CoreConfig instead. This makes sure that it works also for find_package(Qt5Core) calls. Task-number: QTBUG-75580 Change-Id: I85267c6bd86f9291ec2e170fddab1006ab684b5c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement developer / non-prefix buildsAlexandru Croitor2019-05-156-159/+442
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* cmake: Correct way to save/restore env varsAlbert Astals Cid2019-05-101-6/+27
| | | | | | | for pkgconfig it is different if they are not defined vs an empty string Change-Id: Ifb05db5dab32a699aafa32d91f9719eab78dee44 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Wrap DBus1 find_package call to fix xproto not being picked upTobias Hunger2019-05-101-0/+10
| | | | | | | | | | | | | | DBus1 (1.12) configuration file breaks PKG_CONFIG environment variables and will thus prevent other libraries to be picked up by pkgconfig. Main sympthom is that xproto is not getting picked up anymore, which results in hundreds of lines of warnings about this being printed. Work around that by wrapping the call to find_package(DBus1) and restoring the environment. Change-Id: Ia69f10b014dddc32045b40972500a843e5d29b38 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: pro2cmake.py: Separate library extraction logic from writing out dataTobias Hunger2019-05-091-3/+6
| | | | | | | | | | | | | | Separate the logic to find all used libraries from the code that writes out the link_library information into the CMakeLists(.gen)?.txt files. This patch will remove some "PUBLIC_LIBRARIES Qt::Core" from generated files. This is due to us handling some Qt libraries in special ways in some of our add_qt_* helpers. These special libraries were added to the LIBRARIES section, but actually they should be added to the PUBLIC_LIBRARIES section instead. Do so now, so that the newly generated files do not break things again. Change-Id: I588781087a8aecc4d879e949735671d8085f0698 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>