summaryrefslogtreecommitdiffstats
path: root/cmake/QtFeature.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: add detection of x86 VAES and AVX512VBMI2 featuresThiago Macieira2022-03-081-2/+2
| | | | | | | | We have VAES code in qhash.cpp that isn't getting compiled right now. Change-Id: Ibf4acec0f166495998f7fffd16d6961261dec361 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: enable machine_tuple also on GNU/HurdPino Toscano2022-02-111-1/+1
| | | | | | | | On the Hurd there is the standard GCC toolchain, so it is possible to query GCC for -dumpmachine. Change-Id: Idc8e80c0937147a8ea656bc0320a83d647278455 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add support building Qt with the 'mold' linkerAlexandru Croitor2022-01-201-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | The mold linker is a new linker for Linux that provides faster link times compared to BFD ld, ld.gold and lld. It can be found at https://github.com/rui314/mold To build Qt with mold, ensure that the binary in your PATH and then configure Qt with with either cmake /path/to/qtbase -DINPUT_linker=mold or /path/to/qtbase/configure --linker mold The change was tested with gcc 9, clang 10, clang 12, mold 1.0.0. Only qtbase and qtdeclarative (and dependencies) were tested. Pick-to: 6.2 6.3 Task-number: QTBUG-99270 Change-Id: I2e64a1f4257c37ff5b64a9326e548b9b46e07c80 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Fix detection of linker availabilityAlexandru Croitor2022-01-181-9/+31
| | | | | | | | | | | | | | | | | | | | Previously we passed flags like -ld-fuse=lld only to compile calls, but not to the link call of a compile test project. Make sure to pass it to the link call instead by using check_cxx_source_compiles + CMAKE_REQUIRED_LINK_OPTIONS instead of check_cxx_compiler_flag. Note the flag that is passed is still via passed via the compiler launcher and not directly to the linker. Remove duplicate flag handling code. Pick-to: 6.2 6.3 Change-Id: I1bf90573904a9df83240b6debfee3cc9e425c6bb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Support configure -platform linux-clang-libc++Allan Sandfeld Jensen2021-12-141-0/+14
| | | | | | | | Detect libc++ config and add appropriate compiler and linker flags. Pick-to: 6.3 Change-Id: I9ec91b3ace987599d4e79e43b1b75aa67cd5caeb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix config tests not finding module-provided CMake packagesJoerg Bornemann2021-10-131-1/+6
| | | | | | | | | | | | | | | | This amends commit 165e01d5d51d16377542c1b3ffbc22f03fb75e97. Above commit broke the code that adds "${PROJECT_SOURCE_DIR}/cmake" to CMAKE_MODULE_PATH. The semicolon that separates entries of CMAKE_MODULE_PATH must be escaped. Otherwise, the semicolon separates elements of the flags list. Additionally, fix the QT_AVOID_CUSTOM_PLATFORM_MODULES code path which lacked the addition of "${PROJECT_SOURCE_DIR}/cmake". Pick-to: 6.2 Change-Id: I72f78cf066cabe6b0002dce1aa0294aa0dc9cbf0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't use libs in /usr/local for configure tests by default on macOSJoerg Bornemann2021-10-081-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit f3c7d22dd04afe8d889585fb5d6426f3d4591e74 we do not use libraries from /usr/local and other non-system locations on macOS. But our configure tests still did. This led to discrepancies between find_package calls in configure tests and the Qt project itself. Mentioned commit removed /usr/local and friends from CMAKE_SYSTEM_PREFIX_PATH. But we can't pass this variable to the configure tests, because CMake sets it up and overwrites our value. Pass CMAKE_SYSTEM_PREFIX_PATH and CMAKE_SYSTEM_FRAMEWORK_PATH as QT_CONFIGURE_TEST_CMAKE_SYSTEM_{PREFIX|FRAMEWORK}_PATH variables to tests. Tests with separate project files that call find_package() must add code like this after the project() command: if(DEFINED QT_CONFIGURE_TEST_CMAKE_SYSTEM_PREFIX_PATH) set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIGURE_TEST_CMAKE_SYSTEM_PREFIX_PATH}") endif() if(DEFINED QT_CONFIGURE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH) set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIGURE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}") endif() Adjust pro2cmake accordingly. Task-number: QTBUG-97076 Change-Id: Iac1622768d1200e6ea63be569eef12b7eada6c76 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Ensure that UNIX is set for INTEGRITYJoerg Bornemann2021-10-051-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain platform-related variables, in this case UNIX, must be set in a platform module, because they get cleared after the toolchain file is loaded. Such platform modules live in upstream CMake, but there is none yet for INTEGRITY. This manifests in an undefined UNIX variable and "System is unknown to CMake" warnings for the project and every configure test. Add the CMake module "Platform/Integrity" in the cmake/platforms directory. Add this directory to CMAKE_MODULE_PATH to let CMake load Platform/Integrity when the toolchain file set CMAKE_SYSTEM_NAME to "Integrity". CMake's module directory takes precedence, when loading platform modules. This is special for platform modules and different from the documented behavior of CMAKE_MODULE_PATH and include(). In case the user wants to provide their own platform modules via CMAKE_MODULE_PATH, they can instruct Qt to not add its path by setting QT_AVOID_CUSTOM_PLATFORM_MODULES to ON. Make sure that configure tests with project files also load the custom platform module. Pick-to: 6.2 Fixes: QTBUG-96998 Change-Id: I9855d620d24dc66353cec5e847a2675b464ace26 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix separate_debug_info configure test for cross-compilationJoerg Bornemann2021-09-281-0/+1
| | | | | | | | | | | | | | | The separate_debug_info configure test uses the CMake variable CMAKE_OBJCOPY. CMakeFindBinUtils in the test project finds the host's objcopy despite CMAKE_TOOLCHAIN_FILE being correctly set. We now add CMAKE_OBJCOPY to the list of variables that are passed to configure test projects and remove the CMakeFindBinUtils include, which looks rather internal anyways. Pick-to: 6.2 Fixes: QTBUG-96798 Change-Id: I164c6bd1771e8789e9dd19b50573b33b8866bd3b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use only supported values when setting internal QT_FEATURE_ valuesAlexey Edelev2021-09-211-1/+5
| | | | | | | | | | | When setting QT_FEATURE_ values we need to convert the user-provided FEATURE_ values to the one that is supported by QT_FEATURE_. Pick-to: 6.2 Fixes: QTBUG-96300 Change-Id: Idd19fbf7f23f351a6c1cfdcedccfaaf6b0aa6e44 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Pass CMAKE compiler flags to arch detectionAllan Sandfeld Jensen2021-09-201-0/+10
| | | | | | | | | | This fixes the detection of always available architecture based on user set CMAKE flags. Change-Id: I541ac9569766a0fe05f4395c06f2ee3bcd77b035 Fixes: QTBUG-91090 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Properly export MODULE_PLUGIN_TYPESAlexandru Croitor2021-08-261-1/+1
| | | | | | | | | | | | | | | | Don't export the MODULE_PLUGIN_TYPES property only when a module has an associated configure.cmake file with features. Instead, always export it if a module defines a plugin type. This fixes qttools DesignerTargets.cmake file to contain the plugin types it defines, given that the Designer lib does not declare any features via a configure.cmake file. Pick-to: 6.2 Task-number: QTBUG-95668 Change-Id: Ic036c31768e03b51d3bce9c2afe48e04f69f435b Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix feature evaluation for feature definesJoerg Bornemann2021-08-171-1/+6
| | | | | | | | | | | | | | | | | Passing -DFEATURE_developer_build=TRUE did not add the define QT_BUILD_INTERNAL to src/corelib/global/qconfig.h like -DFEATURE_developer_build=ON would. This happened, because the feature evaluation in qt_evaluate_feature_definition did a string comparison against "ON". Normalize both sides of the string comparison, and thus support all booly values for features. Pick-to: 6.2 Fixes: QTBUG-95732 Change-Id: Ibf03579c05919b35219438361fc93676b7cca7cc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Make precompiled headers work for Android on WindowsJoerg Bornemann2021-08-171-0/+9
| | | | | | | | | | | | | | When building Qt for Android on Windows, the precompile_headers test failed if the source directory was passed as absolute path without drive letter. See CMake upstream issue #22534. Work around the CMake issue by ensuring that the path is properly prefixed with a drive letter. Pick-to: 6.2 Fixes: QTBUG-95652 Change-Id: I3154b6c0bb2f53533306227074b24fbbf5973b05 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't repeat conditions of use_*_linker features in QtFeature.cmakeJoerg Bornemann2021-07-131-9/+3
| | | | | | | | | | | | | | qt_config_linker_supports() repeated the conditions of all use_*_linker features, because the features are not evaluated yet when this function is called, and the function needs to know what linker is used to build Qt. Move the required tests and features before any qt_config_linker_supports() call and evaluate the use_*_linker features early. Change-Id: I306f032356682a0e82e4d7c4234e5bbc820ab143 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix reconfiguration error when features have EMIT_IF conditionsAlexandru Croitor2021-07-091-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a feature was marked as not to be emitted and there was no user provided value for that feature, the build system would still save the user provided value in FEATURE_foo with a value of ON (if the conditions were met). After a reconfiguration, the build system would hit the code path that checks if the user provided a value for the non-emitted feature, and would then warn about it and reset the feature value to OFF. This would cause errors when reconfiguring a user project, complaining that a feature value has changed. Make sure to not save the user provided value for a non-emitted feature and to always set its internal feature value to OFF. Amends c4f5762b20dc20bab3cc62e9166d0e5b36e21cc6 Pick-to: 6.2 Fixes: QTBUG-94921 Change-Id: I257c7fd795c8a6aeba3348cb72522e4f0b006dc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Rename and document the feature evaluation functionsAlexandru Croitor2021-07-091-25/+60
| | | | | | | | | | | | | | | | | | | | Rename various functions and variables to hopefully make the behavior of feature evaluation clearer. The previous names like 'set_value' or 'set_cache_value' or 'cache' were too generic and unclear. One would have to carefully read the code to understand what was actually set. Add some doc comments about what FEATURE_foo and QT_FEATURE_foo represent. Amends c4f5762b20dc20bab3cc62e9166d0e5b36e21cc6 Pick-to: 6.2 Task-number: QTBUG-94921 Change-Id: Ie6a7b83a4d54a83976b2706d4af82b39832d79f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add the check for linker capabilities to resolve circular dependenciesAlexey Edelev2021-06-101-2/+6
| | | | | | | | | | | | | | 'ld' only capable to resolve circular dependencies by wrapping the suspected static libraries and objects using --start/end-group arguments. We want to detect if linker is 'ld' at configure time to decide how to link the resource objects if finalizers are not enabled. The qt_config_compile_test function is extended with an extra argument since it's required to pass custom cmake flags to the ld-related test. Pick-to: 6.2 Change-Id: I484fcc99e2886952d8b0232f37e4e6a35d072931 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow printing config summary even if module is not builtAlexandru Croitor2021-06-011-1/+17
| | | | | | | | | | | | | | In the future it might be useful to print the config summary entries of a Qt module configure.cmake file even if the associated module is not built and thus qt_feature_module_begin is not called. The repo src/CMakeLists.txt could then use a combination of qt_feature_evaluate_features and a conditional qt_feature_record_summary_entries to ensure the that summary entries are still shown. Change-Id: I124efc82163ddae48d9e72c70a677ec4c6588fac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix building multi-arch universal macOS QtAlexandru Croitor2021-04-011-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the same approach we use for iOS, which is to set multiple CMAKE_OSX_ARCHITECTURES values and let the clang front end deal with lipo-ing the final libraries. For now, Qt can be configured to build universal macOS libraries by passing 2 architectures to CMake, either via: -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" or -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" Currently we recommend specifying the intel x86_64 arch as the first one, to get an intel slice configuration that is comparable to a non-universal intel build. Specifying the arm64 slice first could pessimize optimizations and reduce the feature set for the intel slice due to the limitation that we run configure tests only once. The first specified architecture is the one used to do all the configure tests. It 'mostly' defines the common feature set of both architecture slices, with the excepion of some special handling for sse2 and neon instructions. In the future we might want to run at least the Qt architecture config test for all specified architectures, so that we can extract all the supported sub-arches and instruction sets in a reliable way. For now, we use the same sse2 hack as for iOS simulator_and_device builds, otherwise QtGui fails to link due to missing qt_memfill32_sse2 and other symbols. The hack is somewhat augmented to ensure that reconfiguration still succeeds (same issue happened with iOS). Previously the sse2 feature condition was broken due to force setting the feature to be ON. Now the condition also checks for a special QT_FORCE_FEATURE_sse2 variable which we set internally. Note that we shouldn't build for arm64e, because the binaries get killed when running on AS with the following message: kernel: exec_mach_imgact: not running binary built against preview arm64e ABI. Aslo, by default, we disable the arm64 slice for qt sql plugins, mostly because the CI provisioned sql libraries that we depend on only contain x86_64 slices, and trying to build the sql plugins for both slices will fail with linker errors. This behavior can be disabled for all targets marked by qt_internal_force_macos_intel_arch, by setting the QT_FORCE_MACOS_ALL_ARCHES CMake option to ON. To disble it per-target one can set QT_FORCE_MACOS_ALL_ARCHES_${target} to ON. Task-number: QTBUG-85447 Change-Id: Iccb5dfcc1a21a8a8292bd3817df0ea46c3445f75 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* configure: Fix error when turning on/off non-emitted featuresJoerg Bornemann2021-03-091-14/+14
| | | | | | | | | | | | | | | | | Features that are not emitted in the current configuration (e.g. plugin-manifests on Linux) should not yield an error. Instead, print a warning message like Qt5's configure did. Set insignificant feature to OFF. Remove the now unneeded emit_if parameter from qt_feature_set_cache_value. Pick-to: 6.1 Fixes: QTBUG-88305 Change-Id: I0f2ce152fca5f08417038c9bd2c07639ff6a3df4 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* More helpful error message when merging qt features in CMakeAndreas Buhr2021-02-101-1/+1
| | | | | | | | | | When a feature is set in qtbase and is later set to another value, an error occurs and an error message is given. This patch changes the error message to contain both the preexisting and the new value Change-Id: Ifa9fc1f06bfde40e8fd5dfdf30165d4393abbd28 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Do not export the QT_PLUGINS target property of Qt modulesJoerg Bornemann2021-01-201-1/+1
| | | | | | | | | | | This property is dynamically determined and set in the Qt6${module-name}PluginsConfig.cmake files now. There is no need anymore to export this property. Change-Id: I2d164864c4099034b88f9ad852eae8b9f9e55f8b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix missed feature evaluation errors in reportAlexey Edelev2021-01-151-1/+1
| | | | | | | | | | | | Add an optional argument to store the report command while feature evaluation-only stage. This is necessary, because according to the actual feature evaluation process, evaluation happens only once and it's impossible to record any command during the evaluation-only stage. Fixes: QTBUG-90319 Change-Id: I215fbe0a28a2661cd2d97d253b2e2c787d295cbd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* CMake: Print feature condition errors in configure reportAlexey Edelev2021-01-051-2/+2
| | | | | | | | | | | Add output of feature condition error at the end of configuration summary. Introduce qt_configure_add_report_error that may be used to add error to end-point configure report without actual configure interruption. Fixes: QTBUG-88282 Change-Id: Idcf478da863ae6507438eb3370927d7d1f01e071 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Add detection of FEATURE_foo change by userAlexey Edelev2020-12-171-13/+20
| | | | | | | | | | | | | | | | | | | | | Unset all QT_FEATURE_foo values for every build. If any of FEATURE_foo is different of QT_FEATURE_foo, mark whole Qt build as dirty. Reset FEATURE_foo for dirty builds to the calculated value if it doesn't meet its condition. Set Qt module as NOT FOUND if its target was not created during configuration. Main issue with this approach are generated files, that became trash once the related features are disabled. This especially affects features that enable/disable Qt modules. FooConfig.cmake files are created and generate lots of warnings if feature was disabled. We may introduce a module cleanup procedure at some point. Fixes: QTBUG-85962 Pick-to: 6.0 Change-Id: Id71c1edb4027b24c6793063e40cc9d612c24ebce Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Add debug information for 'qt_evaluate_config_expression'Alexey Edelev2020-11-301-3/+64
| | | | | | | | | | | | Add '_qt_internal_dump_expression_values' function that dumps all values evaluated by 'qt_evaluate_config_expression'. '_qt_internal_dump_expression_values' doesn't evaluate undefined features, only collect actual values. Fixes: QTBUG-88476 Pick-to: 6.0 Change-Id: I9d09ffbd9f9fa91bc4f36536c58e7f118b06f9b9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Change way of 'INPUT_' values handlingAlexey Edelev2020-11-201-9/+13
| | | | | | | | | | | | Move 'INPUT_' variable detection logic out of 'qt_feature_set_cache_value' function. Use 'INPUT_' variable to enable/disable related 'FEATURE_' in case if 'FEATURE_' is not defined. Fixes: QTBUG-88501 Pick-to: 6.0 6.0.0 Change-Id: I1162ac0fb562036898a37b52c3f80229ec8a0970 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Rework INPUT_ variables handlingAlexey Edelev2020-11-061-10/+9
| | | | | | | | | | | | INPUT_ variables enable FEATURE_ variable only in case if valid "true"-like value is assigned from command line. Amends dc43061e9abb15bc07eb236f5344c79d27590812 Fixes: QTBUG-87755 Task-number: QTBUG-88142 Change-Id: I65e85c7548981fdec94366b531f6df6396be71b7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add handling of user-defined INPUT_foo cache variablesAlexey Edelev2020-11-031-2/+10
| | | | | | | | | | | | "configure" script translates feature-related parameters to INPUT_ variables instead of FEATURE_. Both INPUT_ and FEATURE_ variables passed to cmake script are equivalent. FEATURE_ has higher priority in case if both are defined. Fixes: QTBUG-87755 Change-Id: If697a0d62ab839877a3196ea74e631582a570dda Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow lower-case values in feature valuesJoerg Bornemann2020-10-291-4/+6
| | | | | | | | | | | | CMake considers ON/OFF as booly string values regardless of the case. Make the value comparison in QtFeature.cmake case-independent. It's now possible to build Qt with '-DFEATURE_gui=off'. Fixes: QTBUG-87948 Change-Id: I3d948e8219ad9728414803c8c4cd756034073b46 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Rolf Eike Beer <eb@emlix.com>
* CMake: Actually evaluate AUTODETECT expressions in featuresJoerg Bornemann2020-08-231-1/+2
| | | | | | | | Very simple AUTODETECT expressions worked fine, but expressions with parentheses, for example, were not correctly evaluated. Change-Id: Ibec4fa55474e149a701f861838fdea41d31beca0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support configure tests of type 'linkerSupportsFlag'Joerg Bornemann2020-08-231-0/+28
| | | | | | Task-number: QTBUG-86155 Change-Id: I3764d99cd4ad1c432b499ec9ba7c4c48391fa421 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support configure tests of type 'compilerSupportsFlag'Joerg Bornemann2020-08-201-0/+11
| | | | | | Task-number: QTBUG-86155 Change-Id: Iaa5c48b6508870a0f6afdf9df66cd2e634fe19b3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Introduce QtFeatureCommon.cmakeJoerg Bornemann2020-08-131-10/+2
| | | | | | | | This file provides common feature-functionality is supposed to be included by QtFeature.cmake and QtProcessConfigureArgs.cmake. Change-Id: Ifb483c2a9c4014d240c2a4d6ff07b5c0ceee9c3a Reviewed-by: Alexandru Croitor <alexandru.croitor@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 missing qdevice.pri values and qt.conf info for AndroidAlexandru Croitor2020-07-091-1/+1
| | | | | | | | | | | | | | | | 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: Adjust some status messages about syncqt and file generationAlexandru Croitor2020-06-301-1/+0
| | | | | | | | | | | 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: Generate qdevice.pri when cross-buildingJoerg Bornemann2020-06-291-0/+19
| | | | | | | | | | | | | 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: Fix double-negation of feature CONFIG valuesJoerg Bornemann2020-06-291-1/+5
| | | | | | | | | The plugin-manifests feature has the "negative" CONFIG value "no_plugin_manifest". On negation, we're supposed to strip off the leading "no_" instead of adding another one. Change-Id: Id2c66da41f22881272d5b923f12b85d9fcc2c9d0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow module names starting with digitsMike Krus2020-05-311-2/+2
| | | | | | | This was allowed with QMake. Change-Id: Ia3052cd2086d633a343cfe59afddded2f79fc551 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix qmake .depends info generated for module_private.pri filesAlexandru Croitor2020-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Previously we checked the LINK_LIBRARIES property of the main module target, but we should instead use the values of INTERFACE_LINK_LIBRARIES set on the FooPrivate module. Because both versionless targets and private targets are interface libraries, we need to properly differentiate between them when following versionless targets to their main associated target. To do that, instead of using string comparison, export an additional private _qt_is_versionless_target property, and query that. Also make sure to set and export the _qt_config_module_name property on the FooPrivate targets. Also make sure to APPEND to EXPORT_PROPERTIES rather than override (looking at you QtFeature.cmake). Task-number: QTBUG-75666 Change-Id: Ia3261e218840e9f5217ab49755e8c876560e294d Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix handling of negated feature config valuesJoerg Bornemann2020-04-211-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | Consider a negated feature config value like the following: qt_feature_config("foo" QMAKE_PUBLIC_QT_CONFIG NEGATE) If this feature was disabled, it would turn up in both, enabled_features and disabled_features of module .pri files. Also, QT_CONFIG would contain foo. Expected however is that QT_CONFIG contains no-foo, and only disabled_features contains foo. Fix this by prepending a "no_" prefix to the value, similar to the "no-" prefix in the qmake build. The qt_correct_config function was adjusted to recognize "no_foo" and translate it to the qmakeish "no-foo" config value. Config values that start with "no_" but do not correspond to a feature are left untouched. You can still have values like "no_valley_too_deep" or "no_mountain_too_high". Change-Id: I23d8b18c84e04ea6dfa25cc6ccd8f7e86211b144 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Handle missing packages in project compile testsAlexandru Croitor2020-04-091-1/+19
| | | | | | | | | | | | | | | | | If a find_package() in a try_compile project doesn't find a package, and we then link against a non-existent target, the configuration failure of the compile test also fails the configuration of the project. To avoid that, separate library targets from non-targets, and make sure to only link against the targets if they exist. pro2cmake now outputs modified compile test project code which iterates over targets and non-target libraries, and links against them when needed. Change-Id: Ib0f4b5f07af13929c42d01a661df2cabdf9b926b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: Simplify semicolon escaping in qt_config_compile_testAlexandru Croitor2020-04-071-12/+7
| | | | | | | | | | list(JOIN) removes a layer of escaping, which force doubling up on the backslashes. Instead use string(REPLACE) thus making the escaping a bit saner. Change-Id: Ie3daf0112dd09fbcbaf8798552949470952611c9 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Handle standalone config.tests in configure libraries sectionAlexandru Croitor2020-04-031-2/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some library entries in configure.json have a test entry. An example is assimp in qtquick3d. qmake tries to find the library via the sources section, and then tries to compile the test found in config.tests/assimp/assimp.pro while automagically passing it the include and link flags it found for assimp. We didn't handle that in CMake, and now we kind of do. configurejson2cmake will now create a corresponding qt_config_compile_test call where it will pass a list of packages and libraries to find and link against. pro2cmake will in turn generate new code for the standalone config.test project. This code will iterate over packages that need to be found (like WrapAssimp) and then link against a list of passed-in targets. In this way the config.test/assimp/main.cpp file can successfully use assimp code (due to propagated include headers). qt_config_compile_test is augmented to take a new PACKAGES argument, with an example as follows PACKAGES PACKAGE Foo 6 COMPONENTS Bar PACKAGE Baz REQUIRED The arguments will be parsed and passed to the try_compile project, to call find_package() on them. We also need to pass the C/C++ standard values to the try_compile project, as well as other try_compile specific flags, like the toolchain, as given by qt_get_platform_try_compile_vars(). Change-Id: I4a3f76c75309c70c78e580b80114b33870b2cf79 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Define QT_STATIC for static buildsJoerg Bornemann2020-04-011-4/+12
| | | | | | | | | | QT_STATIC must be defined for static builds to have the right import/export symbol macros defined. Originally, this macro is wrapped in a condition. That's why we extend qt_feature_definition to be able to write a prerequisite to qconfig.h. Change-Id: I610e60acc7f5bdc031eff6d53a76e0b229a5c8c2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Remove APPLE prefix from platform namesTor Arne Vestbø2020-03-161-1/+1
| | | | | | | None of the other platforms have it. Change-Id: Ib448c2c03ba03f711b507ef391977c0e6aa7c192 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Port most of the configure summary supportAlexandru Croitor2020-03-091-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Teaches configurejson2cmake about summaries / reports, so things like enabled features, configure sections, notes, etc. Add relevant CMake API for adding summary sections and entries, as well as configure reports. The commands record the passed data, and the data is later evaluated when the summary needs to be printed. This is needed, to ensure that all features are evaluated by the time the summary is printed. Some report and summary entries are not generated if they mention a feature that is explicitly exclduded by configurejson2cmake's feature mapping dictionary. This is to prevent CMake from failing at configure time when trying to evaluate an unknown feature. We should re-enable these in the future. A few custom report types are skipped by configurejson2cmake (like values of qmake CONFIG or buildParts). These will have to be addressed a case-by-case basis if still needed. Change-Id: I95d74ce34734d347681905f15a781f64b5bd5edc Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix stack-protector-strong test and featureJoerg Bornemann2020-03-041-2/+5
| | | | | | | | | And in order to do this we must teach qt_config_compile_test a COMPILE_OPTIONS argument. Change-Id: I66fa45142b544e3a2fc599af1c1a4c69b442b318 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>