summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Don't generate prl libs for Windows shared libsAlexandru Croitor2020-08-041-7/+15
| | | | | | | | | | | | | Windows shared library prl files should not have a QMAKE_PRL_LIBS section. Such information is not useful because it's not used by the linker as per 523c7e3fd55c853dd424d57f28e225d57439cf89 Amends 46d7abc9172f82756ccd3641a314dcc066353c3f Task-number: QTBUG-85240 Task-number: QTBUG-85801 Change-Id: Ic40491a568f72c507a16322f6f0c61f98d3a5913 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QtCore: Use system-wide libb2 if presentLinus Jahn2020-07-311-0/+7
| | | | | | | | | | | | This adds the option to build Qt with libb2, which is especially recommended, if you care about the performance of the BLAKE2 hashing algorithms. The bundled version is the pure reference C implementation of BLAKE2, while libb2 has many additional hardware optimizations. However, the API of both is the same, so no changes to the code were necessary here. Change-Id: I3563982f4e07be300291fe103c38b16a404b3ebb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix generated content of prl files (again)Alexandru Croitor2020-07-315-92/+131
| | | | | | | | | | | | | | | | | | | | | | | | | Apply the same kind of transformations to the contents of the prl files as we do for pri files. Mainly, transform system library paths that are absolute, into link flags to make them relocatable across systems. Also change the Qt frameworks to be linked via the -framework flags instead of via absolute paths. Implementation notes Move the common required functions for both QtFinishPrlFile and QtGenerateLibPri into a common QtGenerateLibHelpers.cmake file. Make sure it's listed as a dependency for the custom commands. Also make sure to pass the necessary input values like possible library prefixes and suffixes, as well as the link flag. Task-number: QTBUG-85240 Task-number: QTBUG-85801 Change-Id: I36f24207f92a1d2ed3ed2d81bb96e4e62d927b6e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Introduce qt_internal_add_appAlexandru Croitor2020-07-314-9/+149
| | | | | | | | | | | | | | | This new function is meant to be used where load(qt_app) is used. It delegates functionality to qt_add_executable, while handling some additional behavior via a finalization function (mostly handling of macOS Info.plist files and icons, as well as Windows icons and resource files) It uses a new PlatformAppInternal interface target. Task-number: QTBUG-85757 Change-Id: I1a2d5851b137fcd4a6323e0e06fb154f91619800 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix building debug apps with qmake on WindowsAlexandru Croitor2020-07-292-36/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our CMake build system only generated working .prl files for the Release configuration in debug_and_release. This caused a linking failure when building a Widgets example that links against qtmain, specifically qtmaind.lib(qtmain_win.cpp.obj) : error LNK2019: unresolved external symbol __imp_CommandLineToArgvW referenced in function WinMain The symbol is located in shell32.dll, which was not linked in, because there was no qtmaind.prl file. The fix to generate per config prl files is a bit complicated, because add_custom_command does not support generator expressions in OUTPUT and DEPENDS. Instead we pre-generate 2 files per config, one with the preliminary prl file content and another file that contains the final prl file path (via generator expression). Then we iterate over all configurations and create custom commands with well known paths, and the final prl file is created by the script called by the command. Amends 06557312d2a030f9ff771488bd6c97690a125a3d Task-number: QTBUG-85240 Change-Id: I413b705bc69732b0cbe1ee8cd089a1aef19365db Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix _nolink targets to be optional on the consumer sideAlexandru Croitor2020-07-291-11/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, if Qt is built with Vulkan support but the user's machine does not have Vulkan, it should still be possible to configure and build an application (if the application does not use Vulkan of course). When Qt is built with qmake, the special windows_vulkan_sdk.prf file makes sure not to export build time Vulkan include headers into the generated .pri files. The same file also tries to find the include headers via an environment variable. If it isn't set, it just adds a bogus "/include" include path, which doesn't fail a user's application build. This wasn't the case for an application built with CMake, because the exported Vulkan_nolink target uncodinitionally referenced Vulkan's target properties. Which means that if the Vulkan package was not found, the application failed to configure. To mimic qmake's behavior, make sure to query the target properties only if the Vulkan target exists, via the TARGET_EXISTS generator expression. Apply the same logic to all _nolink targets. This might not be entirely correct in all cases, but we can revise this behavior later after more feedback. At the very least it allows building non-Vulkan based applications. Task-number: QTBUG-85240 Change-Id: Iffbb03a84e8637ed54d0811433e66fe6de43d71f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* cmake: Add some air to configure summaryTor Arne Vestbø2020-07-261-4/+3
| | | | | Change-Id: I3408957d8a81ac3080eac28e48dbafe9059e22f5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make missing XCode a warning instead of an errorAlex Richardson2020-07-261-1/+1
| | | | | | | | This fixes the macOS build when you only have the CommandLineTools installed. Change-Id: I620bc535b508b604a875f53dec8c57af23efeac1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* cmake: Add LOWDPI option to match CONFIG+=testcase_lowdpiTor Arne Vestbø2020-07-241-1/+9
| | | | | Change-Id: I8bcabf41ed353ec4e940a8fcea5b698e0ddf278f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix handling of CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATHAlexandru Croitor2020-07-244-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While trying to implement the 'host artifact reuse' Coin instructions change, a bug surfaced where the qemu configurations didn't find the host tools and instead tried to use the cross-compiled tools while building qtbase, which failed due to not finding the runtime linker (another unsolved issue). Before the host artifact reuse change, the host tools were found successfully. The difference that caused the issue is that the target install prefix was a direct subfolder of the host prefix. host - /home/qt/work/qt/install target - /home/qt/work/qt/install/target Before the host reuse change the install prefixes were as follows host - /home/qt/work/qt/install/host target - /home/qt/work/qt/install/target While looking for the Qt6CoreTools package, we temporarily set CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH to contain first '/home/qt/work/qt/install' and then '/home/qt/work/qt/install/target'. CMake then reroots the CMAKE_PREFIX_PATH values onto values in CMAKE_FIND_ROOT_PATH, making an MxN list of prefixes to search. Rerooting essentially means concatenating 2 paths, unless the considered prefix is a subfolder of the root path. What happened was that the first considered value was '/home/qt/work/qt/install/home/qt/work/qt/install', a non-existent location that gets discarded. The second considered value was '/home/qt/work/qt/install/target. The second value is the result of seeing that '/home/qt/work/qt/install/target' is a subfolder of '/home/qt/work/qt/install' and thus the root path is stripped. All of this is done in cmFindPackageCommand::FindConfig() -> cmFindCommon::RerootPaths. The behavior above caused the target tools be found instead of the host ones. Before the host reuse change, both of the initial constructed prefixes were discared due to them not existing, e.g. '/home/qt/work/qt/install/target/home/qt/work/qt/install/target' and '/home/qt/work/qt/install/host/home/qt/work/qt/install/host' One of the later prefixes combined CMAKE_FIND_ROOT_PATH == '/home/qt/work/qt/install/host' + CMAKE_PREFIX_PATH == '/' resulting in '/home/qt/work/qt/install/host/' and this accidentally found the host tools package. We actually stumbled upon this issue a while ago when implementing Qt 5.14 Android CMake support in 52c799ed4425076df4353c02950ea1444fe5f102 That commit message mentions the fix is to add a "lib/cmake" suffix to the PATHS option of find_package(). This would cause the subfolder => strip root behavior mentioned above. So finally the fix. First, make sure not to append QT_HOST_PATH in the toolchain file, there shouldn't be any need to do that, give that we temporarily set it when looking for Tools packages. Second, recreate the subdir scenario in the Qt toolchain file by setting CMAKE_FIND_ROOT_PATH to the current (relocated) install prefix as usual, but also setting CMAKE_PREFIX_PATH to a new value poining to the CMake directory. Aka '/home/alex/qt' and '/home/alex/qt/lib/cmake'. Third, when a QT_HOST_PATH is given, save 2 paths in the generated Qt toolchain: QT_HOST_PATH and QT_HOST_PATH_CMAKE_DIR. There are the host equivalents of the target ones above. Use these values when looking for host tools in Qt6CoreModuleDependencies.cmake, again facilitaing the subdir behavior. Note these are currently absolute paths and are not relocatable. We'll have to figure out if it's even possible to make the host path relocatable. Finally as a cleanup, look for the Qt6HostInfo package in QtSetup strictly in the given QT_HOST_PATH, so CMake doesn't accidentally find a system Qt package. Change-Id: Iefbcfbbcedd35f1c33417ab7e9f44eaf35ff6337 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Add -Wsuggest-override for gcc >= 9.2Alexander Volkov2020-07-241-0/+4
| | | | | | | | | gcc doesn't report warnings for final methods since version 9.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010 Change-Id: I7152351aac0e3bad86d777e119f25137ef97ec6f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Avoid enabling of "warnings_are_errors" flags for testsAlexander Volkov2020-07-231-1/+1
| | | | | | | | Change added dep in qt_add_cmake_library(): PlarformModuleInternal -> PlatformCommonInternal. Change-Id: I303a6a520f0dda7260b12cb21673b8f1a23d536b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* testlib selftest: Don't pass TESTARGS to Catch2Tor Arne Vestbø2020-07-231-2/+6
| | | | | | | It doesn't understand the arguments we usually pass to testlib. Change-Id: Iea83d1d8c31a510b2bc442cbfc810eac631322e7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Print various CMake and Qt CMake information variablesAlexandru Croitor2020-07-202-9/+90
| | | | | | | | | | | Sometimes the info we show in the configure summary might differ from the information that CMake computes. To more easily debug and fix such cases, print out various CMake info variables like host and target info, compiler versions, sdk versions, etc. Change-Id: I37a11dfabe5369236af78684a09bd3cec3fdd398 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Pass CMAKE_OSX_ARCHITECTURES to try_compile on macOSAlexandru Croitor2020-07-201-9/+11
| | | | | | | | | | | | | | | | | | | | There was an inconsistency where configuring qtbase on Apple Silicon with the following command line produced different results rom the second variant. $ cmake ../qtbase -DCMAKE_OSX_ARCHITECTURES=arm64 vs $ CMAKE_OSX_ARCHITECTURES=arm64 cmake ../qtbase That happened because the CMAKE_OSX_ARCHITECTURES variables was not passed to project-based try_compile calls. This resulted in compile tests like SIMD avx to succeeded on Apple silicon, which shouldn't. To address that, always pass the architecture on macOS if it's specified. Change-Id: Ia12e86230cc6e5e11f387e3cbb273d90646ef2e3 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix configuration of CMake tests in-build-treeAlexandru Croitor2020-07-201-5/+11
| | | | | | | | | | | | Qt6 package was not found the tests were configured in-tree as opposed to standalone tests. Use the same trick we do for building examples in-tree. Specify the path to the build tree packages, and don't create targets. Amends 96e3ee06598d00e7155f3f8574759ea658a134e5 Change-Id: Ia60de416ce0afff5bd40be8c0c6e3c7898fd7ebf Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Provide old style CMake variables for target infoAlexandru Croitor2020-07-173-0/+62
| | | | | | | | | | | | | | | | | | | | | This change provides the following per-module variables Qt6Widgets_LIBRARIES, Qt6Widgets_INCLUDE_DIRS, Qt6Widgets_DEFINITIONS, Qt6Widgets_COMPILE_DEFINITIONS, Qt6Widgets_PRIVATE_INCLUDE_DIRS. These are deprecated and are only intended for easier porting from Qt5 to Qt6. Qt consumers should instead rely on the Qt module targets e.g target_link_libraries(app PRIVATE Qt6::Widgets) Note that the variable contents includes transitive values for everything except the _LIBRARIES variant. So Qt6Widgets_INCLUDE_DIRS will contain values for Widgets, Gui and Core. Qt6Widgets_LIBRARIES only contains a value like Qt6::Widgets, and when that is used in target_link_libraries(), CMake will take care of the transitivity. Change-Id: I625e25aab7ba5eaf14de1dc76ba2a1a0c85e6226 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix old style find_package(Qt6Foo) to workAlexandru Croitor2020-07-172-1/+16
| | | | | | | | | | Each module package needs to first find the Qt6 package to ensure that all the necessary info is setup for further depedencies to be found. Task-number: QTBUG-81672 Change-Id: I3ee608d24c1efbb63a063261fb36341bf52fb78d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add OS-specific prelude to qt-cmake-standalone-testJonas Karlsson2020-07-151-0/+2
| | | | | | | | | | | | This makes sure the executable is run as a shell script with the proper interpreter on Unix systems. Otherwise it will fail in some shells, like fish. On windows, it prevents all commands in the batch file from displaying on the screen. Change-Id: If554262f172b035b9661b3e2ff26a96789fa707b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix QT_STAGING_PREFIX for repos other than qtbaseJoerg Bornemann2020-07-133-2/+18
| | | | | | | | | | | | | For repositories other than qtbase the QT_STAGING_PREFIX was empty, because it was only determined in qtbase. Also, we save the CMAKE_STAGING_PREFIX in the Qt6BuildInternals package and set this variable if it's not explicitly set by the user. As with CMAKE_INSTALL_PREFIX this behavior can be prevented by defining QT_BUILD_INTERNALS_NO_FORCE_SET_STAGING_PREFIX=ON. Change-Id: I73100abbef24f5d3fb8f82029d0374176edc8048 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix CMAKE_INSTALL_PREFIX assignment in QtBuildInternalsExtraJoerg Bornemann2020-07-131-1/+1
| | | | | | | | The prefix value must be surrounded by double quotes in case it contains whitespace. Change-Id: I393c57368d7a255f5042e363405071ef042afc18 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix incorrect SIMD arch_haswell and avx profile conditionsAllan Sandfeld Jensen2020-07-092-5/+41
| | | | | | | | | | | | | | | | | | | | Fix the conditions in qt_add_simd_part for arch_haswell and the avx512 profiles to mimic what simd.prf does. Add missing SIMD flags in QtCompilerOptimization for arch_haswell. Compute the compile flags for the avx512 profiles from the profile dependencies. Remove the special case in Gui that hardcoded the compilation of qdrawhelper_avx2.cpp to be conditional on avx2 being enabled instead of arch_haswell. The Gui project already has another qt_add_simd_part that is enabled if arch_haswell is enabled, which will now work correctly due to the fixes in qt_add_simd_part. Change-Id: I7a61a03b5565d4fa438f22b329e0d9dd7acd9273 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix various issues with the Android buildAlexandru Croitor2020-07-091-2/+1
| | | | | | | | | | | | | | | | | | | Certain resources and compiled jar files have to be copied into the non-prefix build dir location. They were previously only installed, which doesn't do anything in a non-prefix build. Change pro2cmake to generate code that places the compiled java jars into QT_BUILD_DIR, so that non-prefix builds work. Place the module dependencies xml files into lib folder in non-prefix builds. Don't special case the output and install location of the Android QPA plugin. Task-number: QTBUG-85399 Change-Id: I4ac9d3929ea8ecc95ec99a77e621ad2121b68832 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix missing qdevice.pri values and qt.conf info for AndroidAlexandru Croitor2020-07-092-3/+30
| | | | | | | | | | | | | | | | qdevice.pri should embed info about the Android SDK, NDK, host, platform api level and ABI. The machine tuple test should not be run for uikit and Android platforms. Sysroot should also not be prepended for uikit and Android platforms, otherwise it breaks Qt module include paths. Task-number: QTBUG-85399 Task-number: QTBUG-82581 Change-Id: Ic48c88f6ab15d75c2ebc323c8d7a3b7e5596f3c1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix path to qt-cmake in configure summaryJoerg Bornemann2020-07-091-1/+1
| | | | | | | The path was wrong if CMAKE_STAGING_PREFIX was set. Change-Id: Iec90c7a5edf0da80a0ac108fe3411c340c01e9a9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix qt-cmake-standalone-test when CMAKE_STAGING_PREFIX is setJoerg Bornemann2020-07-091-3/+3
| | | | | | | | | | The qt-cmake-standalone-test script is kind of a "host tool" and contained paths to CMAKE_INSTALL_PREFIX, which is wrong if CMAKE_STAGING_PREFIX points to somewhere else. Fixes: QTBUG-85336 Change-Id: I4828dc6868d55cfc60f3ad2199185230d5cc9028 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Introduce QT_STAGING_PREFIXJoerg Bornemann2020-07-092-10/+4
| | | | | | | | | | | Add the cache variable QT_STAGING_PREFIX that is the same as CMAKE_STAGING_PREFIX - if it's set, or CMAKE_INSTALL_PREFIX otherwise. Use the variable in the places where we check for the emptiness of CMAKE_STAGING_PREFIX to use CMAKE_INSTALL_PREFIX. Change-Id: I372d57dfa41818c1965b824c59ab3cac80b38f60 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix -pch configure optionJoerg Bornemann2020-07-081-1/+1
| | | | | | | This amends dbd3c759654. Change-Id: Ia87d60f1da65624bc5c6ffb915eecf99a2d8bdc0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support the -rpath configure argumentJoerg Bornemann2020-07-081-0/+10
| | | | | | Task-number: QTBUG-85373 Change-Id: I04bdf307556aeab607a95d153cbe19254044c1f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support the -c++std configure argumentJoerg Bornemann2020-07-081-0/+4
| | | | | | Task-number: QTBUG-85373 Change-Id: I071c1d0c8bf96b34c5733d039b8a61e54e416800 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support the -qtnamespace configure argumentJoerg Bornemann2020-07-081-0/+3
| | | | | | Task-number: QTBUG-85373 Change-Id: I3f995b31339a3c2b0c97ca806c652bc67846fc69 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support mkspec-related configure argumentsJoerg Bornemann2020-07-081-0/+16
| | | | | | Task-number: QTBUG-85373 Change-Id: I44ae15b4c05f23442ac6b9d69d31f22f01d0a48c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support -static, -shared and -framework configure argumentsJoerg Bornemann2020-07-081-0/+7
| | | | | | Task-number: QTBUG-85373 Change-Id: I0a1db7dcb4cb1738fa1ba0a687d41c5f5a613364 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Write EXTRA_RPATHS to qmodule.pri if QT_EXTRA_RPATHS is setJoerg Bornemann2020-07-071-0/+5
| | | | | Change-Id: Icd13cc047a9ca33f2ec9b6c2ce8216cbc4ae378b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support configure -force_debug_infoJoerg Bornemann2020-07-061-0/+6
| | | | | | Task-number: QTBUG-85373 Change-Id: Ia798fc2cf715aed9157e1d9e2f64187c16e38bcf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support build config-related configure optionsJoerg Bornemann2020-07-061-0/+21
| | | | | | | | | | This add support for the following options: -debug, -release, -debug-and-release. For the latter, the "Ninja Multi-Config" generator is auto-detected, if ninja is available. Task-number: QTBUG-85373 Change-Id: Ide0ca44e5f4c74657147e89d71e8d71c4f6a4c45 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support -bindir, -libdir, -*dir configure argumentsJoerg Bornemann2020-07-061-0/+10
| | | | | | Task-number: QTBUG-85373 Change-Id: I0df181cb017561c3f0af5ab3fecb76008b89c0d2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Re-work configure flags for CMake generatorsJoerg Bornemann2020-07-061-5/+29
| | | | | | | | | | | | | | | | | Remove the -cmake-makefiles configure argument as its meaning was in essence "do not pass a -G argument to CMake". Instead, we add the following arguments: -cmake-generator <name> to pass -G <name> to CMake -cmake-use-default-generator to pass no -G argument to CMake If none of those arguments is given, we try to autodetect the generator. If a ninja executable is found, we prefer the Ninja generator. On Unix we fall back to "Unix Makefiles". On Windows, we do a poor man's compiler detection and select one of "NMake Makefiles", "NMake Makefiles JOM" and "MinGW Makefiles". Change-Id: Ic36669bd50956d15fbc71cee73720732cd4bfab8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Teach configure.bat the -cmake argumentJoerg Bornemann2020-07-061-0/+115
| | | | | | | | | | | | | | | | | | | | | The configure scripts need to translate configure options to CMake arguments. It is not sensible to implement this translation twice, in sh and Windows batch language, so we're doing this once, in CMake language. The configure scripts write their options into config.opt and call a CMake script that reads config.opt, does the translation to CMake arguments and calls CMake to generate the build system. While we're at it, implement some more translations than the sh configure provided, like -extprefix, -top-level and -skip. Fixes: QTBUG-85349 Fixes: QTBUG-85350 Task-number: QTBUG-85373 Change-Id: Ida5d8b2a3c178b9349d41ec76d190c69a9456e74 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Don't propagate private defines for Qt header modulesAlexandru Croitor2020-07-051-7/+15
| | | | | | | | | | | | Interface libraries like our Qt header modules should not propagated private defines which are meant only for building a specific Qt module, and in the case of a header module there is nothing to build. Exclude the usual private defines we set in qt_add_module for header modules. This also fixes the content of header module .pri files. Change-Id: I0791ebdb73e8b020ddb8116433ed36c7b3d71303 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Fix non-prefix buildsAlexandru Croitor2020-07-021-1/+1
| | | | | | | | | | QT_WILL_INSTALL was set to ON, because an incorrect comparison was done. Amends 062318feb2d3b7598409c7e81e4459c2f4607764 Change-Id: I201aa2a183563ce05077c36ac2ba3bd61cc827c0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Write QT_CPU_FEATURES to qmodule.priJoerg Bornemann2020-07-023-1/+20
| | | | | | | | | | | To achieve this, we save the result of the subarch test in the cache variable TEST_subarch_result and use this value as the right hand side of the QT_CPU_FEATURES.xxx assignment. The Qt6HostInfo package now sets the variable QT6_HOST_INFO_SUBARCHS which will be used for the host_build scope in qmodule.pri when cross-building. Change-Id: I2c25f205bfc0692aef0d6f43ff4e542d27e1b948 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Limit OpenGL deprecation silencing on Apple platform to Qt itselfTor Arne Vestbø2020-07-022-5/+10
| | | | | | | | | | | | | | | | | | | | | Apple deprecated the entire OpenGL API in favor of Metal, which we are aware of, so we don't need to see the warnings when building Qt. Instead of applying the silencing globally for all Qt consumers, both internal and external, we now limit the silencing to Qt itself. That means user code that explicitly uses any of the deprecated APIs will see the warnings. Note that this does not apply to merely using any of the Qt OpenGL APIs. The user has to explicitly use the platform APIs that have been deprecated. The warnings need to be disabled on a build system level, so that that they are passed as -D flags on the command line. If the defines were done in Qt headers (qguiglobal.h e.g.), they would require the user to always include this header before any of the Apple headers. Change-Id: I3f2a2a5211332a059ad4416394251772c677fdcb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Document the mapping of configure options to CMake argumentsJoerg Bornemann2020-07-022-0/+163
| | | | | | | | | Add internal documentation how to map configure options to CMake arguments. This patch adds a markdown file with a giant table, and cmake/README.md links to it. Change-Id: I94a6a4ee24ed0114ccb3095d2c13cf5d84e2de72 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix non-prefix build detection when CMAKE_STAGING_PREFIX is setJoerg Bornemann2020-07-012-7/+25
| | | | | | | | | | | | | | | | It wasn't possible to create a cross, non-prefix build with CMAKE_INSTALL_PREFIX set to something else but the qtbase build dir and CMAKE_STAGING_PREFIX set to the qtbase build dir. This would be equivalent to configure -prefix /usr \ -extprefix ~/my/qtbase/build/dir Fix this by comparing the qtbase build dir against CMAKE_STAGING_PREFIX if it is set. We also have to adjust the QT_BUILD_DIR variable in a similar way. Change-Id: Iaba5cf0f6954ae4b15d8af1fc62634f5d7f68835 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix qconfig.cpp for cross-buildsJoerg Bornemann2020-07-011-21/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch modifies the two preprocessor definitions QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH and QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH which are exclusively used by qmake (and not QtCore's QLibraryInfo) to determine the ext prefix and the host prefix. In the qmake build of Qt, qmake considers the host prefix as "location where qmake is installed". This is usually the same as the ext prefix but can be modified by the user at configure time. In the CMake build, we don't build tools for the host but always for the target platform. The QT_HOST_PATH is an external prefix we never install to. That means, the qmake we build is always installed into the ext prefix (CMAKE_STAGING_PREFIX or CMAKE_INSTALL_PREFIX). Therefore, we can calculate the path of <ext_prefix>/bin relative to <ext_prefix> and use this value for both, QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH and QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH. The "path of <ext_prefix>/bin relative to <ext_prefix>" is equivalent to just the "path <prefix>/bin relative to <prefix>", meaning we can safely use <prefix>, which is just CMAKE_INSTALL_PREFIX. Task-number: QTBUG-84886 Change-Id: Ie1d4628a7049ddfd0d0a56dfe4ee2f2bb4952277 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Enable bitcode when targeting UIKIT aka iOSAlexandru Croitor2020-07-012-3/+23
| | | | | | | | | | | | | | | | | Building an iOS app with qmake failed because Qt itself was not built with bitcode enabled. Enable building with bitcode. Make sure qrc resource files and bundled 3rd party libraries also build with the regular Qt module flags and thus with bitcode enabled. As a consequence gc_sections has to be disabled for UIKIT platforms. Task-number: QTBUG-82581 Task-number: QTBUG-84781 Task-number: QTBUG-85240 Change-Id: I15fe668725a139c02f2a32a5db849b46d4ce325c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Use non-sanitized plugin type names in .pri filesAlexandru Croitor2020-07-011-2/+10
| | | | | | | | | | | | | | | This is required for qmake to correctly pick up and use plugins that have strange characters in the types (slashes for platforms/darwin type and dashes for wayland plugin types). This fixes some issues with trying to build an iOS application using qmake due to the qiosnsphotolibrarysupport plugin. Task-number: QTBUG-85240 Task-number: QTBUG-84781 Task-number: QTBUG-82581 Change-Id: I94faf2d3dbbdeb22dbd96dfb11c7bff00645b524 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Specify Prefix in target_qt.conf for non-prefix buildsAlexandru Croitor2020-07-011-0/+3
| | | | | | | | | | | | | | | | | The EffectivePaths section does not inherit the Prefix value from the Paths section. Specfiy it explicitly, otherwise the paths reported by qmake -query for /get variants ended up containing an extra "./bin/" part, which ended up breaking building iOS apps with qmake. Amends d7fd6848612760124871f0f3b55917250d078dd5 Task-number: QTBUG-85240 Task-number: QTBUG-84781 Task-number: QTBUG-82581 Change-Id: I288a6e76a21d779a7e03443777f8a4ce28df9974 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Use correct framework link flags in scripts and .pri filesAlexandru Croitor2020-07-013-5/+4
| | | | | | | | | | | | | | | | | | | | | target_link_libraries expects a quoted string like "-framework CoreFoundation" when linking frameworks and not 2 different arguments like "-framework" "CoreFoundation". Fix that in the FindWrapOpenGL and FindGLESv2 find modules. Make sure to not quote the framework link flags when generating .pri files even if there are spaces, otherwise building apps with qmake fails. Amends 7fcc9cf05500fd3a0a1ba5c2f90a8ad3bcd8e5b0 Amends 2ed63e587eefb246dba9e69aa01fdb2abb2def13 Amends 55a15a1c1b93d36d705fc69e44b5c806b807dd55 Amends 2a767ab4bb7de8c29d2a8365212244ed944e9aeb Task-number: QTBUG-85240 Change-Id: I66ba36760ad704d65e712072a528d9e25c336dfa Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>