summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Fix qt_lib_XXX.pri files for modules with CONFIG_MODULE_NAME setJoerg Bornemann2020-03-301-30/+31
| | | | | | | | | | | | The function qt_generate_module_pri_file did not take into account the CONFIG_MODULE_NAME argument of qt_add_module. This resulted in wrong file names and content, e.g. qt_lib_test.pri instead of qt_lib_testlib.pri. Fixes: QTBUG-83176 Change-Id: Id6991396cf9ea5a1d155aa15402c0d84a8a9d082 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* CMake: Fix the re-computed value of INSTALL_*DIR variablesJoerg Bornemann2020-03-251-1/+4
| | | | | | | | | | | | | | | For INSTALL_*DIR variables that have the the same value as CMAKE_INSTALL_PREFIX, a second cmake run cleared the value. This is because file(RELATIVE_PATH) returns the empty string if we pass the same absolute paths. Fix this by checking the return value of file(RELATIVE_PATH) for the empty string and setting it to ".". It's a limitation of qmake that empty strings are not handled as ".". Change-Id: I8fc4d1eabcc9d5634be2f3741b0002a347dd17e6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix creation of forwarding headers to be at configure timeAlexandru Croitor2020-03-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | qt_add_module checks for the existence of the following directory include/QtFoo/6.0.0/Foo when deciding whether a private module target should contain that path in its INTERFACE_INCLUDE_DIRECTORIES. There are 2 cases when it's created, when running syncqt, and inside qt_install_injections. If syncqt doesn't create it because there are no private headers (like in qttools/src/global), qt_install_injections created it at generation time (for injected configure headers like qttools-config_p.h) Unfortunately that caused the existence check mentioned above to fail, not exporting the path in the QtToolsPrivate's include directories, and failing the qttools build. To fix that, create the injection files (and directories) at configure time, using qt_configure_file instead of file(GENERATE). Change-Id: Idd9b6ec36e986c4de95d11557170e1c70927211c Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Introduce qt_configure_fileAlexandru Croitor2020-03-231-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Add global / top-level docs targetsAlexandru Croitor2020-03-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously you could use either module-specific or repo-specific 'docs' targets. For example 'ninja html_docs_qtbase' or 'ninja html_docs_Core'. Now there's a global / top-level target called 'docs', so 'ninja docs' works. For super builds it will build the documentation of all configured repositories. For a single repo build, it's equivalent to calling 'ninja docs_repo_name'. Also for consistency, add the "docs_Core" target, which was missing before. So now a 'docs' target exsits for repo names AND targets. New global target names are - docs - prepare_docs - generate_docs - html_docs - qch_docs - install_html_docs_docs - install_qch_docs_docs - install_docs_docs Amends 0095ff4e0659906595d281b37c3b7f89e37250af Change-Id: I686be1e0962e40cbce860e8ac2cabb056b360ac2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Fix Windows VM Test RunsLeander Beernaert2020-03-161-26/+8
| | | | | | | | | | | | | | | | | | | | Simplify the handling of simd specific sources. The previous implementation was causing simd instructions to bleed into the main library. The tests were failing because the avx instruction were leaking into Qt6Gui due to the previous problem. This in turn caused any test which required Qt6Gui code run to crash since it is not possible to run avx instruction in the VMs. This patch also disables PCH for the simd sources as they result in warnings related related to using PCH header not compiled for the architecture in question. The latter can cause the build to fail in conjunction with warnings as errors. Change-Id: I1be98f2f5e967f33793d6a2e6134a24ef1709566 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* CMake: Don't make a private module depend 1kk times on the public oneAlexandru Croitor2020-03-131-1/+2
| | | | | | | | | The exported INTERFACE_LINK_LIBRARIES property now looks a lot more sane. Change-Id: I093fcb242607023dd0b103298562b299cb803028 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/+7
| | | | | | | | | 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: Remove code for old 3rdparty mechanism handlingAlexandru Croitor2020-03-101-96/+0
| | | | | | | | | | The only two uses (QtHarfbuzz and QtDoubleConversion) have been removed, so now the code is not needed anymore. Change-Id: Id9ef628fa139f1431395bcdd1705463dfafb1051 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Handle path components like INSTALL_LIBDIR more correctlyAlexandru Croitor2020-03-101-36/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | We recomputed INSTALL_LIBDIR for every new repo that is configured, which is incorrect due losing any custom provided libdir when configuring qtbase. Save that information (and all other path components) in QtBuildInternalsConfigExtra.cmake. Make sure not to-recompute that information when configuring a project other than QtBase. Allow providing absolute paths instead of relative paths for these variables. Note that only absolute paths pointing somewhere under the prefix will currently work, otherwise configuraion will fail. If we need to support such a use case, we'll have to carefully check all code that use these path components to make sure they handle absolute paths correctly (current assumption is relative paths everywhere). Use the computed paths when generating the qconfig.cpp file which is used for qmake -query. Task-number: QTBUG-81289 Change-Id: I331aa00e47988fe0ee4e533b5f95c4df11c4d96f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Port the 'separate_debug_info' featureJoerg Bornemann2020-03-061-0/+9
| | | | | | | | | | | | | | | 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>
* Add QT_MODULE_SKIP_MODULE_INCLUDES propertyLeander Beernaert2020-03-051-1/+4
| | | | | | | | | | When a Qt module has this property set, when we generate the QtModuleDepends header file and find this module it will not be added. This is required to be able to create a Core_qobject module, as it does not have any headers. Change-Id: Iaea1080919d05ace12e48693e02d8c0f4c669339 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Handle conditions in third party find modules correctlyAlexandru Croitor2020-03-051-0/+22
| | | | | | | | | | | | | | | | | | | | | 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: Generate Win32 Resource FilesLeander Beernaert2020-02-251-2/+37
| | | | | | | | | | | | | | Add support to generate win32 resources files through CMake. The functionality is implemented via qt6_generate_win32_rc_file() in Qt6CoreMacros.cmake. Currently qt_add_test(), qt_add_module() and add_qt_gui_executable() call the above function when building on windows. The function itself has been written as part of the public API so it can be called from other locations if required. Change-Id: Id5388b3bf9a2068b36780d8268306326f990778c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Port the reduce-relocations featureJoerg Bornemann2020-02-251-0/+15
| | | | | | | | | | As reduce-relocations implies bsymbolic_functions, we also add the -Bsymbolic-functions linker flag. Also, handle the .dynlist files that are passed to the linker by bsymbolic_functions.prf in the qmake build. Change-Id: I535c33fba888596d2f8975b16864bbe9f0a7caa4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Check for syncqt private headers directory before usingAlexandru Croitor2020-02-251-1/+7
| | | | | | | | | | | | | | | Only existing directory paths should be added to INTERFACE_INCLUDE_DIRECTORIES, otherwise projects fail to configure. If after running syncqt there is no private headers directory created (due to the module not having any _p.h files), such a path should not be added as an interface include path. This fixes consumers of QtZlib, where there are no private headers. Change-Id: I3fd1a7b5eb8f816d178d6d91223baa6f377e6f9f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* CMake: Fix 3rd party library installationAlexandru Croitor2020-02-251-3/+12
| | | | | | | | | | | | | | | | Libraries created with qt_add_3rdparty_library should be installed when the qmake 'installed' value is set in CONFIG. Introduce a new INSTALL option to handle that in CMake projects. If the value is provided, the library should always be installed regardless of whether it's a shared or static library. Fix the libraries to be installed to BINDIR/LIBDIR instead of the config install dir. Also install the CMake config files into the config install dir. Change-Id: I86f1ef47680f08669a77db77e0d986f47d5fae2d Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Allow creation of modules with no qtfoo-config.h fileAlexandru Croitor2020-02-251-2/+2
| | | | | | | | | | | | | Useful for header only modules that are declared in the same directory as a regular module, but which doesn't have any features and thus has no qtfoo-config.h file. Will be used for the qtzlib module, which is built when system_zlib feature is disabled. Change-Id: I60c5f73c3e2a3a481a16c5872e06d5d109a04b10 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Add functions to allow setting symbol visibility flagsAlexandru Croitor2020-02-251-0/+14
| | | | | | | | Needed for 3rd party library code. Change-Id: Ib994de1980515e849d4368249024d3d5e064fb46 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Allow disabling warnings similar to CONFIG += warn_offAlexandru Croitor2020-02-251-0/+8
| | | | | | | | | | | The QT_COMPILE_OPTIONS_WARNINGS_OFF property can be set on targets in order to disable adding the default compiler warnings flags. This is useful when building 3rd party library code. Change-Id: I9f58ca4543b5ea0d2051b7f94f0042d24c4e3a16 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Fix use of compile define QT_NO_DEBUGLeander Beernaert2020-02-201-1/+1
| | | | | | | | | | | | Prior to this patch QT_NO_DEBUG would not be correctly set for generators which support multiple configurations such as Visual Studio and XCode. This patch also applies the define to all executables, which was previously missing. Change-Id: I16a911d15217a62093c68ba2b4c2545cdb8df1e6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix PATH environment variable for CMake testsLeander Beernaert2020-02-191-1/+3
| | | | | | | | | | | | This patch fixes setting the correct value for the PATH environment value. Currently, due to Windows' ; path separator, every list entry was treated as a separate environment variable that need to be set instead of properly extending the PATH list. Change-Id: Ib2fc031397459370beec84f9cb4ec6df7db00df3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
* Only install tests data for prefix buildsLeander Beernaert2020-02-181-2/+2
| | | | | | | | | | If we install tests data for non-prefix builds it can cause tests to fail as they find the data in the wrong location. An example of this is tst_qsslkey. Change-Id: I55bd2ff4cb5a0857dc857cb2149ffe4436ec6f99 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Set qt_add_test WORKING_DIRECTORY to OUTPUT_DIRECTORYLeander Beernaert2020-02-181-0/+2
| | | | | | | | | If qt_add_test() is called with OUTPUT_DIRECTORY and no WORKING_DIRECTORY is specified, default the WORKING_DIRECTORY to the same value as OUTPUT_DIRECTORY._ Change-Id: If373fe590508ad58d4632e0598cd0d9dddb2ae16 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: C++17 is mandatoryOlivier Goffart2020-02-181-5/+1
| | | | | Change-Id: Ia0f2151d38fec84be31afc76fc380666861d7d80 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Fix c++ standard config tests with MSVCAlexandru Croitor2020-02-181-0/+8
| | | | | | | | | | | | 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>
* Use INSTALL_DOCDIR when possibleChristophe Giboudeaux2020-02-121-10/+10
| | | | | | | | | Hardcoding 'doc' causes issues when installing qtbase but also when trying to build the other modules documentation. Change-Id: I5c57852add59d0dc0d067813feea0bbb0962c84b Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add support for qt_helper_lib()Leander Beernaert2020-02-121-0/+136
| | | | | | | | | | | | | | | | | Add qt_add_3rdparty_library() function as a replacement for qmake's qt_helper_lib feature. All 3rdparty libraries will be available under the Qt:: alias when built through this method so that they can properly register as dependencies of a Qt module. This patch also adds Qt3rdPartyLibraryConfig.cmake.in to export the CMake configuration for static builds and shared libraries. Change-Id: I52bf3a95ca22fccd9ab54343468847bb1b570c28 Fixes: QTBUG-81969 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Only export public module link dependencies for shared buildsLeander Beernaert2020-02-121-1/+8
| | | | | | | | | Unless we are building under a static library configuration there is no reason to export the dependency on private libraries. Change-Id: I724da38495dc55cc2783d4b19c01533fc0900d22 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Refactor Metatypes dependency propagationLeander Beernaert2020-02-101-2/+0
| | | | | | | | | | | | | | | | Every metatypes.json files is now added as an INTERFACE source file to a target. This enables us later to correctly collect all the metatypes.json files from dependent targets. This information is also correctly exported via export()/install(). To avoid the metatypes.json appearing in every target's source list, the file path is wrapped in a generator expression which will only be evaluated when the consuming target has the property QT_CONSUMES_METATYPES set to true. At the moment this is limited to targets which need to interact with qmltyperegistrar. Change-Id: I0ffebcd069a923383f7ed11cde2c94ecf2fb13f3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't add private module headers for private modules when not neededAlexandru Croitor2020-02-061-4/+5
| | | | | | | | | | | | | | | If a module has the NO_MODULE_HEADERS option, we should not add the private module header paths to the BUILD_INTERFACE of private modules. This fixes building static non-prefix qtdeclarative builds on Linux, where non-existent QtXcbQpa headers failed the qtdeclarative generation step. Change-Id: Ic9fdd8c5688d3449576eb8a5dd852c252e29bf5b Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove qt_add_qml_module() from QtBuildLeander Beernaert2020-02-061-169/+0
| | | | | | | | This bit is being move to QtDeclarative as it is not required to build QtBase. Change-Id: I7b559b8b0e33e66d92c97c93bc43b650e7150237 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Load module specific extensions for QtBuildInternalsLeander Beernaert2020-02-061-0/+8
| | | | | | | | | | | | This patch enables each module to load their own Qt${version}ModuleBuildInternals.cmake to expose module specific features when building Qt. These scripts are only loaded when the package QtBuildInternals has been loaded. Change-Id: Ie58dd93ddd292cf106fe7ef147151a51fd5aa2b1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix qt_add_qml_module() for non-prefix buildsLeander Beernaert2020-02-051-14/+18
| | | | | | | | | | | | | | Always set the installation directory for Qml modules as it is required for qt6_add_qml_module() to set the correct properties so that qml files can be copied to the right location. This patch also fixes the copy of qmldir. As it previously stood, the copied file was not complete as it is possible fore the contents to change after we exit this function. Change-Id: I974269cf0507664b005a93bf27ab19941d99f1d6 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow manually specification of moc.json files for metatype generationLeander Beernaert2020-02-051-2/+17
| | | | | | | | | | | | | | qt6_generate_meta_types_json_file() has been extended to allow the generated moc_....cpp.json files to be manually specified. This now enabled the metatype generation to be used without resorting to AUTOMOC. Additionally, Core_qobject declaration order has been temporarily moved as it otherwise does not produce the correct metatypes dependency file for Core. This will be fixed in a follow up patch. Change-Id: I3266ab3073db478458a0c1dbc8b9fbab16622a64 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* pro2cmake: Handle QT += core-private correctly for modulesAlexandru Croitor2020-02-051-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a module project (Quick) contains QT += core-private, the qmake semantics translated to CMake would mean the following: target_link_libraries(Quick PUBLIC Core) target_link_libraries(Quick PRIVATE CorePrivate) target_link_libraries(QuickPrivate INTERFACE CorePrivate) Whereas a QT_PRIVATE += core-private only means target_link_libraries(Quick PRIVATE CorePrivate) without adding any public dependencies to QuickPrivate. To achieve that, we need a few modifications to both pro2cmake and QtBuild.cmake - pro2cmake doesn't automagically add public and private dependencies to targets when encountering a private module assigned to QT. Instead it generates the logic described above by passing correct LIBRARIES, PUBLIC_LIBRARIES, and PRIVATE_MODULE_INTERFACE values. - pro2cmake doesn't do any dependency magic for non-module targets anymore, like executables, plugins, internal_modules. This means that QT assignments are now regular public dependencies. - qt_add_module and qt_extend_target now accept a new PRIVATE_MODULE_INTERFACE option. - qt_extend_target does not automagically make private modules be public dependencies on other private modules. - qt_extend_target correctly assigns PRIVATE_MODULE_INTERFACE values to Private module only. For other target types, it's a no-op. The change requires regeneration of all projects. When we fix pro2cmake and QtBuild.cmake to properly handle internal_modules (create only Private modules without creating a non-Private counter part), we will need another project regeneration to correctly assign dependencies. Change-Id: I4c21f26b3ef3b2a4ed208b58bccb65a5b7312f81 Task-number: QTBUG-81780 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qtbase: use syncqt.pl from QT_HOST_PATHSamuli Piippo2020-02-051-0/+6
| | | | | | | | | | Use syncqt.pl from QT_HOST_PATH if that is given, since qtbase sources might not be available and CMAKE_INSTALL_PREFIX doesn't check for sysroot. Change-Id: I165b17a5a02fd4dbb2340bf69a641b8aaab8fabd Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update add_custom_command and add_custom_target dependenciesLeander Beernaert2020-02-031-1/+7
| | | | | | | | | | | If we don't add the executable used by the custom_target and/or custom_command to list of the command's/target's dependencies (DEPENDS) the generated file will not update should the executable change. Change-Id: Idce30f3dd4f756d9e8f6848c5e16f5dd6c7c8f0a Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't hardcode the include directory nameChristophe Giboudeaux2020-01-311-6/+6
| | | | | | | | | | | | 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 library directory nameChristophe Giboudeaux2020-01-311-3/+3
| | | | | | | | | INSTALL_LIBDIR may point to a different directory than "lib". Contributes to QTBUG-81289 Change-Id: Ia8220515e3ee3703539aa28655e6c806736615ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't hardcode the binary directory nameChristophe Giboudeaux2020-01-311-10/+10
| | | | | | | | | | | 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-8/+22
| | | | | | | | | | | | | 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>
* Append to AUTO_MOC_OPTIONS in order not override existing valueLeander Beernaert2020-01-291-2/+4
| | | | | Change-Id: Id1bf607e31ee2baa5ffb6d6b4aedd98ea83e5e15 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Only add --automoc-json to AUTOMOC_OPTIONS for metatypes targetsLeander Beernaert2020-01-291-1/+0
| | | | | Change-Id: I7c2e859a83ea78c2a6cf2ad59c175c1b29a74621 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Generate metatypes dependency fileLeander Beernaert2020-01-291-20/+15
| | | | | | | | | | | | | | | | Due to generator expression it is impossible to recursively evaluate the link dependencies of a target. This is required by QtDeclarative's qmltyperegistrar. To overcome this we generate a ${target}_metatypes_dep.txt file which contain lines with the following pattern: ${PATH_TO_METATYPES.json}=${PATH_TO_METATYPES_DEP.txt} This can be used to recursively evaluate the dependencies at run time. Change-Id: Ia4cee0632c16ba9631e0289db906fe9d320844a3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Don't create convenience plugin target when not neededAlexandru Croitor2020-01-271-1/+1
| | | | | | | | | | | If the OUTPUT_NAME of a plugin is the same as the CMake target name, don't try to create a custom target with the same name. That will cause configuration errors due to duplicate targets. Amends f67d8ae2d4339c50cf0a4ca26f25c3afebc128ea Change-Id: Iaea7c68e22dbc1e345ba10950c312618abba4c21 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix plugin target names to be compatible with Qt 5Alexandru Croitor2020-01-271-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, qmake generates CMake Config files which expose the plugins as imported libraries. The name of these libraries are derived from the plugin class name. So QCocoaIntegrationPlugin, and not qcocoa. To keep compatibility between Qt5 and Qt6 CMake target names, the pro2cmake script should generate plugin target names based on the plugin class names. To avoid passing the same name in qt_add_plugin (target and CLASS_NAME), derive the class name from the target if the class name is not explicitly specified. Also add a new OUTPUT_NAME parameter which is used to change the final file name of the plugin, so that it's compatible with Qt5. For example to generate a qcocoa.dylib file, instead of QCocoaIntegrationPlugin.dylib file. The same OUTPUT_NAME value will be used for generation of plugin .prl files for qmake consumption. Change-Id: I4d53e680d7beb62befecd359cdf6bba60a34ff0d Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add initial support for CMake "Ninja Multi-Config" generatorAlexandru Croitor2020-01-271-5/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Support for QML Type RegistrarLeander Beernaert2020-01-241-71/+7
| | | | | Change-Id: Ifc1f44cf40b22c20ab768333ba9d5ce58a5f7250 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix dependencies for SIMD object libraries in macOS framework buildsAlexandru Croitor2020-01-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This manifested in Coin when ninja tried to build qdrawhelper_sse2.cpp before the Core framework headers were copied, resulting in a fatal error: 'qatomic.h' file not found. Make sure every SIMD object library has all PRIVATE dependencies of its parent library PRIVATE dependencies (except for other SIMD object libraries), to make sure that the framework headers are copied by the time the SIMD source file is compiled. Here's an example for clarification. Gui_simd_sse2's LINK_LIBRARIES property should have all the values of Gui's LINK_LIBRARIES property (like Qt::Core) filtering out all SIMD object library targets ( like Gui_simd_sse2, Gui_simd_sse3, etc). Thus we make sure the SIMD object libraries are built after Gui's dependencies are built. Note that using INTERFACE_LINK_LIBRARIES to avoid the filtering of SIMD targets in the generator expression would only work in shared Qt builds. In static Qt builds where PRIVATE dependencies become PUBLIC, CMake would insert $<LINK_ONLY:Gui_simd_foo> entries in INTERFACE_LINK_LIBRARIES which causes CMake to be confused and fail at generation time. Change-Id: I246c1394b9c9830c0ebd11e6621e56b992a6a1f2 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>