summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* CMake: Fix top-level .prl file generationAlexandru Croitor2020-07-011-20/+51
| | | | | | | | | | | | | | | | | | | | Promotes qt_find_package()'d targets and their transitive dependency targets to global scope. This will allow .prl file generation to access targets in a sibling repo scope. Retrofits qt_collect_libs() to be a bit more general, so it can be reused both for prl lib collection, and traversing of dependencies of qt_find_package() provided targets. Removes the bail out checks for top-level static builds. Amends 8c8c0f65e322f6599bfe0e7d0752c386f1275bd5 Amends dde11715d357f95370850f5e4eebebcbe7964fb3 Task-number: QTBUG-84874 Fixes: QTBUG-84917 Change-Id: Id95b4cb7a0887c52f35c40bfdb96ad4a68dd6794 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Adjust some status messages about syncqt and file generationAlexandru Croitor2020-06-303-4/+1
| | | | | | | | | | | Show a status message when we run syncqt for a module (gives a bit more insight into why the configuration seems to stall for a moment). Remove some uninformative messages about generating config.h files and Depends headers, etc. Change-Id: I5ff2774b9cf5d92ddde564dc09f4197c2835ee4a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't use libraries in /usr/local by default on macOSAlexandru Croitor2020-06-293-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qmake builds of Qt don't use libraries in /usr/local because the path is not considered a system path. Only the SDK path should be used as a source of system libraries. We should do the same for the CMake builds, which involves a couple of things. Tell CMake not to consider /usr/local (and a bunch of other paths) as system prefix paths. Disable pkg-config usage which by default is not used in qmake Windows and macOS builds. If a user wishes to use libraries located in /usr/local on macOS, they can explicitly enable the behavior via -DFEATURE_pkg_config=ON. In addition to enabling pkg-config, that will also disable the system prefix modification described above. Implementation notes To disable pkg-config usage, we set an empty path for PKG_CONFIG_EXECUTABLE, because there is no other good way. The downside to this is that a lot of warning messages will be printed that the pkg-config package can not be found. The pkg-config feature needs to be computed in QtBuildInternals before qtbase/src/configure.cmake, because it's too late to do it in that file where a few qt_find_package calls already exist. The feature value is also saved to QtBuildInternalsExtra, to make sure that pkg-config is disabled whenever building another repo. System prefix adjustment is done by removing paths from CMAKE_SYSTEM_PREFIX_PATH. Ideally we would remove also /usr as a path, to match what qmake does, but that breaks find_program() calls for perl, python, etc. We have to make sure that qt_find_package does not look in PATH when looking for packages, which is the default behavior, because PATH on macOS most likely contains /usr/local. One last curiosity for future generations is that CMake 3.18+ has merged a change to prioritise SDK locations over regular /usr/lib. Fixes: QTBUG-85261 Change-Id: I28fe5bae7997507a83b37b4eb1e0188e64062c57 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Generate qdevice.pri when cross-buildingJoerg Bornemann2020-06-293-0/+42
| | | | | | | | | | | | | This adds the CMake equivalent to the classical -device-option key=value configure argument: -DQT_QMAKE_DEVICE_OPTIONS=key1=value1[;keyN=valueN] The keys and values get dumped verbatim into qdevice.pri. This patch also ports the machineTuple configure test. Its result is written into qdevice.pri as value for the GCC_MACHINE_DUMP variable. Change-Id: I29f2323fd87639fafaed99ec7446c7ee75504705 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow to pass a custom target mkspec nameJoerg Bornemann2020-06-291-11/+14
| | | | | | | | It's now possible to pass -DQT_QMAKE_TARGET_MKSPEC=foo to cmake. If the value is not passed, then we will guess the mkspec like we did before. Change-Id: If6e8324654cb8bd83d3cba9eb6ee1e4ad2692a2c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Write host architecture and ABI to qconfig.priJoerg Bornemann2020-06-292-2/+19
| | | | | | | ...when cross-building Qt. Change-Id: I7d2fe83167fc278fde9f0c0fd70f5fa42fa62862 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>