summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused EXE_FLAGS option from qt_internal_add_executable()Craig Scott2021-09-181-1/+0
| | | | | | | | | | The EXE_FLAGS option wasn't being used anywhere in any Qt repo and it had no documentation as to its intended use. Remove it. Pick-to: 6.2 Change-Id: I2f67ec57c1da7dc6eab81d5351361e770d19d7d5 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't cache QT_SYNCQT across buildsJoerg Bornemann2021-09-031-4/+0
| | | | | | | | | | | | | | | | | | | | | | There is no need for this variable to be stored in CMake's cache. We don't perform expensive operations to set up QT_SYNCQT, and we even unset the cache variable to ensure it gets recomputed on reconfiguration. We still store QT_SYNCQT in a global property, because the function qt_ensure_sync_qt is called in different directory scopes, and we want to avoid re-calculations for every subdir. It's now possible for the user to set QT_SYNCQT (see QTBUG-88088 for motivation). Also, in a non-prefix build, changes to syncqt.pl in the source dir are reflected upon re-configuration in the build tree (because qt_copy_or_install is called on every configure). Pick-to: 6.2 Fixes: QTBUG-88088 Task-number: QTBUG-75290 Change-Id: I6137b060d200d3dafd4a64d5a6c1bd2549723d78 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Move the logic associated with platform definition directoryAlexey Edelev2021-07-131-26/+0
| | | | | | | | | | | | | | | | | | Since platform definition directory is used as an interface include path of the Qt::Platform target, it makes sense to define it for this target only. Also the definition of cached values that contain path to platform definition looks redundand. The definition of QT_PLATFORM_DEFINITION_DIR from command line doesn't make any sense since build procedure doesn't take it into account when installing mkspecs and the use if the user-provided QT_PLATFORM_DEFINITION_DIR value as a Qt::Platform include directory causes inconsistency in the prefixed builds. INSTALL_MKSPECSDIR and QT_QMAKE_TARGET_MKSPEC should be used instead. Change-Id: I3636c57b835cb84511a358a0910cc482c5fbd81e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix platform definition directory in top-level buildAlexey Edelev2021-07-071-1/+1
| | | | | | | | | | | | | | QT_BUILD_DIR should be used instead of CMAKE_BINARY_DIR as a base directory for platform definition when building a non-prefixed build since artifacts are copied to qtbase directory for top-level build. Amends 478f5fcde66a49b710c427447916a0ee0e4d9e0a Pick-to: 6.1 6.2 Task-number: QTBUG-94973 Change-Id: I5cce16fdc7f760b954222ae67a4b85d4beea7f13 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix the detection of platform definitions directoryAlexey Edelev2021-07-051-25/+33
| | | | | | | | | | | | | | | | | | Platform definition directory is defined when building qtbase. Depending on the build type (prefixed/non-prefixed) it should point: - To the source directory when building prefixed qtbase. - To the installation directory of the prefixed qtbase when building consumer projects. - To the build directory of non-prefixed qtbase when building non-prefixed qtbase or consumer projects. TODO: It is desirable to move the logic asssociated with Qt platform definition to the qt_internal_setup_public_platform_target function. Pick-to: 6.1 6.2 Fixes: QTBUG-94973 Change-Id: I8530613f9b2029834c66206bbdf02475528a4640 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Throw FATAL_ERROR if specified platform doesn't existAlexey Edelev2021-06-251-0/+11
| | | | | | | | | | | If user specifies non-existing platform build fails in some non-obvious place, since qplatfromdefs.h couldn't be found. Add an explicit error if the defined platform folder doesn't exists in Qt sources. Change-Id: Id847d57a6f9cc4f463e697b474b8a669cd041fb8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Move dependency lookup functionality to the common macroAlexey Edelev2021-06-191-1/+1
| | | | | | | | | | Dependency lookup mechanism is the same for modules and plugins. It makes sense to wrap it using macro. Pick-to: 6.2 Change-Id: I73727743b0f5f40b2d94624f65ebfcf85e8dcc59 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add public FindPackageHelpersDominik Holland2021-06-141-0/+1
| | | | | | | | | This makes qt_internal_disable_find_package_global_promotion available, which is needed when linking against QtMultimedia in a static build Pick-to: 6.2 Change-Id: I9b8f6d7b74a8693ac471f8a280e893f4da80a44b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add support for building with clang-clCristian Adam2021-06-041-1/+3
| | | | | | | | | qmake had support for building with clang-cl as the win32-clang-msvc mkspec. Task-number: QTBUG-89642 Task-number: QTBUG-88081 Change-Id: I0709c289f90fedb121620d1e67ef841602219816 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove CMake compatibility functions for old APIJoerg Bornemann2021-06-041-1/+0
| | | | | | | | | All repositories define QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS by now, and we can remove QtCompatibilityHelpers.cmake altogether. Change-Id: I4d8104246e96a4514d5651c104607d651d208d95 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add support for building and installing repo target setsJoerg Bornemann2021-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Introduce the concept of repository target sets, which is a named set of targets within a Qt module repository. In a Qt repository, a repo target set 'qtfoo' can be defined in the top-level project file with qt_internal_define_repo_target_set(qtfoo DEPENDS Bar Baz) The DEPENDS argument specifies Qt components that need to be find_package'd when building the targets that belong to qtfoo. In subdirectory project files, use qt_internal_include_in_repo_target_set(qtfoo) to mark the file as belonging to the repo target set. To build and install a single repo target set, specify QT_BUILD_SINGLE_REPO_TARGET_SET=qtfoo when configuring the Qt repository. Change-Id: Ic9e6213e3225988fd561f315bc857ee44ff17420 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Make qt_internal_walk_libs available in public projectsAlexandru Croitor2021-05-111-0/+2
| | | | | | | | | | | | | | | | | | Needed for the upcoming static plugin mechanism, where we have to extract the list of Qt module dependencies of a target and then extract the plugins associated with those modules. To do that we need to recursively collect the dependencies of a given target. Rename the moved functions to contain the __qt_internal prefix. Also rename the existing QtPublicTargetsHelpers.cmake into QtPlatformTargetHelpers.cmake to avoid confusion with the newly introduced QtPublicTargetHelpers.cmake. Task-number: QTBUG-92933 Change-Id: I48b5b6a8718a3424f59ca60f11fc9e97a809765d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Refactor handling of static pluginsAlexandru Croitor2021-05-111-0/+5
| | | | | | | | | | | | | | | | | | | | Extract common static plugin handling functionality into a separate QtPublicPluginHelpers.cmake file which is loaded by the Qt6 package. Split the code into smaller functions that will be re-used by each templated QtPlugins.cmake.in file, rather than copy pasting the same code into each QtFooPlugins.cmake file. As a drive-by, handle QtFeatures.cmake and QtFeaturesCommon.cmake as public helper files just like QtPublicPluginHelpers.cmake. This makes it clearer that the functions are available outside the internal Qt build and also provides a way for not dumping new helper functions into Qt6CoreMacros.cmake. Task-number: QTBUG-92933 Change-Id: Id816ef009b4fac1cd317d3ef23f21b3530028067 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add _qt_internal_wrap_tool_command to replace QT_TOOL_PATH_SETUP_COMMANDAlexey Edelev2021-04-301-0/+15
| | | | | | | | | | | | | | | | | | | QT_TOOL_PATH_SETUP_COMMAND is used in COMMAND list when call add_custom_command/add_custom_target. This is necessary to setup the necessary environment for the tool to run correctly. This approach is weak according to CMake documentation: "If more than one COMMAND is specified they will be executed in order, but not necessarily composed into a stateful shell or batch script." This change introduces the _qt_internal_wrap_tool_command function that uses a wrapping script that setups necessary environment for the tool and runs it in a single shell. The script is generated by the _qt_generate_tool_command_wrapper function. Change-Id: Id5270b91619b607a0c1e3a19b8c706edec43f388 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add Solaris support in cmake buildNiclas Rosenvik2021-04-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add SOLARIS cmake platform definition. Add settings for QT_DEFAULT_MKSPEC so that qplatformdefs.h can be found. Solaris has its gssapi symbols in libgss. Solaris supports @ORIGIN. Solaris ld does not support --dynamic-list needed for reduce relocations. Make solaris fail the reduce relocation test. getauxval is specific to GNU libc and some other libc implementations on Linux but sys/auxv.h is not. The bootstrap uses sys/aux.h as the only indication for getauxval. This breaks builds on Solaris, so only make sys/auxv.h an indicator for getauxval on linux or glibc based systems. Solaris uses X11 so add it to the X11_SUPPORTED list. Solaris network libraries for sockets etc are in socket and nsl. ifreq does not have a member ifr_ifindex on Solaris, it uses ifr_index. Add test to check if ifr_index is a member of ifreq. The first struct in the in_addr union on solaris is defined as four uint8_t, therefore four arguments are needed for its initializer list. Change-Id: Ieed4c1bbac8559a7ae1db9c4e1e91f609f150270 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* wasm: add cmake build supportLorn Potter2021-04-011-1/+1
| | | | | | | | | | | | | | | | A few configure defines get changed: QMAKE_WASM_PTHREAD_POOL_SIZE is now QT_WASM_PTHREAD_POOL_SIZE QMAKE_WASM_TOTAL_MEMORY is now QT_WASM_INITIAL_MEMORY QMAKE_WASM_SOURCE_MAP_BASE is now QT_WASM_SOURCE_MAP_BASE device-option EMSCRIPTEN_ASYNCIFY=1 is QT_EMSCRIPTEN_ASYNCIFY=1 To create source maps for debugging. use device-option QT_WASM_SOURCE_MAP=1 Task-number: QTBUG-78647 Change-Id: If9f30cd7fb408c386d6d69b5f7b1beecf1ab44b5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove the redundant code related to the QT_NAMESPACE variableAlexey Edelev2021-03-301-5/+0
| | | | | Change-Id: Ib82b199fc7761c8b84f915c2808c7f57bf23927c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Refactor qt_internal_add_plugin() and qt6_add_plugin()Craig Scott2021-03-291-22/+37
| | | | | | | | | | | | | | | | | | | | | | Remove code duplication by calling qt6_add_plugin() from qt_internal_add_plugin(). Separate out the public and internal arguments for the variables defined in QtBuild.cmake for these functions. Provide them via commands instead for greater robustness. This separation allows other Qt repos to access the appropriate set of keywords where they define commands that forward on to *_add_plugin() in their implementations. Retain the old variables for now to simplify the integration steps for updating other repos. The old variables can be removed once there are no more references left to them in any repo. Task-number: QTBUG-88763 Pick-to: 6.1 Change-Id: I0105523afd95995923bd20fc963d245bbb15d34d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Set QT_DEFAULT_MKSPEC for various bsd systemsNiclas Rosenvik2021-03-191-0/+10
| | | | | | | | | Set QT_DEFAULT_MKSPEC for various bsd systems, this is needed to find qplatformdefs.h when compiling. Change-Id: I9450193b737930548f32c87be3525c5ecd1e0e13 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qtdeclarative now directly handles more qml-specific logicCraig Scott2021-03-101-1/+0
| | | | | | | | | | | | | | | | | Associated changes in the qtdeclarative repo now ensure that arguments for qml plugins are handled on the calling side. This reduces the qml-specific logic needed in qtbase and gives qtdeclarative clearer control over qml build and install locations. As part of that work, the INSTALL_LOCATION keyword used in qt_internal_record_rcc_object_files() has been renamed to INSTALL_DIRECTORY to make it consistent with the keyword used for the same concept in other commands. Pick-to: 6.1 Change-Id: Iebd319899f63d79fbe15ce965b84ce324c28a508 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use Core library for qmake instead of the Bootstrap libraryAlexey Edelev2021-02-251-1/+0
| | | | | | | | | | | | | | | | | | | Move the qmake-specific logic of the QLibraryInfo class to qmake internals. 'qconfig.cpp.in' now stores information about the library info entries to keep them consistent between qmake and the Core library. qmake requires specific features enabled in the Core library, so building qmake will be skipped if the features are not enabled. All flags directly related to the qmake have been removed from Core lib. Remove all bootstrap related sections from qmake CMakeLists.txt Task-number: QTBUG-89369 Change-Id: I26de157d3bfd4a5526699296e9d46e1c180b89ae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Reformat shared keyword listsCraig Scott2021-02-241-12/+63
| | | | | | | | | | | | Putting each keyword on its own line makes it much easier to read and improves maintainability. It is friendlier to source control when keywords need to be added or removed. This commit introduces no functional change. Pick-to: 6.1 Change-Id: I79efd039e5afa5f11f1d859405d6487ad6b3beb2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: setup windows tools path only when building on WindowsSamuli Piippo2021-02-111-1/+1
| | | | | | | | | | | Fix cross-compilation on Linux host. Task-number: QTBUG-91052 Pick-to: 6.1 Change-Id: I48c970f0e6af71e3eda3818557e764f60d3836ad Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Rename QML2 imports to QML importsUlf Hermann2021-02-081-1/+1
| | | | | | | | The 2 is meaningless. Task-number: QTBUG-85064 Change-Id: Ic91872804be266d50224fb272b4f4836573f4bf7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix QT_TOOL_PATH_SETUP_COMMANDJuha Vuolle2021-01-271-1/+1
| | | | | | | | | | | | | | Commit 18fc9e1bf821130f0cfe45dc7d5c05b70458e7c0 introduced a Windows-only QT_TOOL_PATH_SETUP_COMMAND to make it possible to call the tool of a module while building the module itself. The "set PATH=..." command in QT_TOOL_PATH_SETUP_COMMAND was flawed, because it contained escaped double quotes which made the set command ineffective. Fix this by removing the escaping of the double quotes. This was uncovered when porting qtscxml to CMake. Change-Id: I5909aa841e7895d6d0feb4037a935b805ccfdc99 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix invalid Qt prefix version when looking for HostInfo moduleAlexey Edelev2021-01-261-11/+0
| | | | | | | | | | | | | | | | | | | In QtSetup.cmake the PROJECT_VERSION_MAJOR variable was used to identify prefix of 'Qt<version>HostInfoConfig.cmake'. Qt<version>HostInfo is not found, if project version differs from qtbase version. Move the 'INSTALL_CMAKE_NAMESPACE' and 'QT_CMAKE_EXPORT_NAMESPACE' variables to 'QtBuildInternalsConfig.cmake'. In this case variables will be exposed for a wider list of internal routines. Use the 'INSTALL_CMAKE_NAMESPACE' variable as prefix to find Qt<version>HostInfo module. Fixes: QTBUG-90345 Change-Id: Ic595d1c5beb74f34e69b58e18590a3afc2f346f7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Move UNICODE and _UNICODE definitions to internal platform targetAlexey Edelev2021-01-191-1/+1
| | | | | | | | | | Move UNICODE and _UNICODE definitions from the public Qt::Platform target to the private Qt::PlatformCommonInternal target. Fixes: QTBUG-89951 Change-Id: Ib4c1c4cab74acda0a43c4ddb3cffd3954393dc89 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Use cmake_language(DEFER) when available for scope finalizersAlexandru Croitor2020-11-251-2/+5
| | | | | | | | | | | | | | If CMake version is 3.19 or greater, use cmake_language(DEFER CALL) for Qt internal scope finalizers, instead of the homegrown implementation. Apart from not depending on the hacky homegrown solution, it significantly improves the readability of --trace-redirect logs. Pick-to: 6.0 Task-number: QTBUG-77377 Change-Id: I5ce374bb313865662c536826e86052bc762438b9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Rename QtBuildInternalsAndroid.cmake to QtAndroidHelpers.cmakeJoerg Bornemann2020-11-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...and include it in QtBuild.cmake. Commit e8d8b1a5e4c added two different code paths to include QtBuildInternalsAndroid.cmake. This was needed, because: In a top-level build, we must not include files that are not yet installed. We have the source tree available, and "${QT_SOURCE_TREE}/cmake" is in CMAKE_MODULE_PATH. We can use the "module syntax" of the include() command. In a per-repository build, when building against an installed qtbase, we must not include files of the source tree, because that's not guaranteed to be available. However, Qt6BuildInternalsConfig.cmake is installed, and we can directly include QtBuildInternalsAndroid.cmake, which is right next to it. We can circumvent this whole issue by moving the Android-related functions out of the Qt6BuildInternals package and including it in QtBuild.cmake. Pick-to: 6.0 Task-number: QTBUG-88718 Change-Id: I5192ba19bb77952505c20d053d7285f798d16ac5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QNX7.1 updatesMarianne Yrjänä2020-11-201-1/+1
| | | | | | | | Updates due to newer compiler version in QNX7.1 Task-number: QTBUG-88300 Change-Id: If9bbc08d49a077d80174a1807e069b5d4ef61c0d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Remove indirection via Startup target for EntryPointTor Arne Vestbø2020-11-121-1/+0
| | | | | | | | | | | | | The EntryPoint interface target now contains all the logic for what flags and optional static libraries to add when the entrypoint is enabled. The target property QT_NO_ENTRYPOINT can be used to disable the entrypoint. Change-Id: I9b14ff729366cd6307789c969ebd4b2ca19de77d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix installation errors in multi-config buildJoerg Bornemann2020-11-101-1/+1
| | | | | | | | | | | In multi-config builds (which equals the debug-and-release feature) we exclude tools of the non-main configurations from the default build. But we still create installation rules for them. Mark those as optional to avoid "cmake --install" yielding errors if those tools weren't built. Fixes: QTBUG-85411 Change-Id: Ic2d3897d1a1c28a715d9a024ec8606fff00e0315 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Yield fatal error on malformed INSTALL_MKSPECSJoerg Bornemann2020-10-301-0/+4
| | | | | | | | The value of this variable must be exactly "mkspecs" or end with "/mkspecs". Change-Id: I39f83e9660794dfe23f5fd39fb1084b87ba1f140 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Let doc targets depend on doc tools in top-level buildJoerg Bornemann2020-10-231-0/+1
| | | | | | | | | | | | | | | For top-level builds it's desirable to have "ninja generate_docs" build all tools needed to generate the documentation. This is problematic since the doc-generating targets are created before the doc tool targets. Thus, we must defer the dependency connection if the doc tool target is not yet available. This patch adds the functions qt_internal_defer_dependency and qt_internal_add_deferred_dependencies. Change-Id: Ica940b80882e67cb0e0943e95541f7f4d1885948 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Introduce Qt6::Startup targetAlexandru Croitor2020-10-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Add an abstraction over Qt::WinMain (aka qtmain.lib) and iOS's runtime linker entry point (_qt_main_wrapper). The Core target will now link against the Startup target on all platforms, instead of just WinMain on Windows. The creation and linkage interface definition of the Startup target is done at find_package(Qt6Core) time via the private call of _qt_internal_setup_startup_target(). This will add automatic linkage of WinMain to executables marked with the WIN32_EXECUTABLE property on Windows. As well as the addition of the '-Wl,-e,_qt_main_wrapper' linker flag when linking iOS executables. Qt users can opt out of this behavior by either setting the QT_NO_LINK_QTMAIN property or variable. This is in line with Qt 5 behavior. Task-number: QTBUG-87060 Change-Id: I7d5e9f1be0e402cf8e67e6f55bfd285f9e6b04f4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* win: Set correct target mkspec for qmake builds for arm64 buildsOliver Wolff2020-10-091-1/+5
| | | | | | | | | | As there is no other way of obtaining information about Qt's paths at the moment, windeployqt is still querying qmake for these information. For a cross compiled Qt, the proper target mkspec has to be set in this case. Change-Id: I0b7b7719c9055d432576185ac4f7572a5ba1dd6b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix leftover usage of qt_add_executableAlexandru Croitor2020-10-071-5/+5
| | | | | | | | | | | All usages should be replaced with qt_internal_add_executable instead. This should fix configuration failure of benchmarks and manual tests. Amends e0c62a48b8a826a46a143e57e94b2a0ea73c7cae Task-number: QTBUG-86815 Change-Id: I0791d849998ed9517e32f699d843367949b97cb9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Add iOS mkspec mapping for the wrapper qmakeAlexandru Croitor2020-10-071-0/+2
| | | | | | | | | | If no mkspec is provided, we default to the macx-clang-ios mkspec when building for iOS. This ensures that the wrapper qmake script is usable for building iOS apps with qmake. Task-number: QTBUG-87218 Change-Id: Ib02b580c8382b04455c9f820163062591d14a15b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: build add flags for building QtAndroid.jarAssam Boudjelthia2020-09-161-0/+1
| | | | | | | | | | | | | Adds -source, -target, -Xlint:unchecked, -bootclasspath flags. Setting default javac build source and target versions to 8. Allow setting custom values for javac build versions via -DQT_ANDROID_JAVAC_SOURCE, and -DQT_ANDROID_JAVAC_TARGET. Task-number: QTBUG-86282 Change-Id: I98f4f193ac96016dc722d178594d7fd401202f68 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix rpaths set for Qt internal apps like DesignerAlexandru Croitor2020-09-111-0/+9
| | | | | | | | | | | | | | | | | qt_apply_rpaths takes into account properties like MACOSX_BUNDLE. This property might not yet be set when qt_internal_add_app is called, but later. To handle that, move the call of qt_apply_rpaths to qt_internal_finalize_app. As a result, the installed apps will have 2 rpaths, the $ORIGIN style relocatable one, and an absolute path one pointing to the Qt prefix/lib. The last one might be unnecessary. Fixes: QTBUG-86514 Change-Id: I25e0d695c78c8b5703e94c99cc2457f772721456 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Port headersclean check to CMakeKai Koehne2020-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Configure Qt with -DQT_FEATURE_headersclean=ON to enable the check. There will be separate target for each module include (e.g. QtCore_header_check), but the check will also be done when the module is built for the first time. There are notable differences to the qmake version: - the build does not pick up anymore default defines or flags from the module, or Qt. Instead options like -fPIC they have to be listed explicitly. Also for this reason, we have to skip the vulkan-related headers from the check, since vulkan/vulkan.h is not necessarily in the compiler's default search path. - some checks for nowadays unsupported compiler versions are removed. - -Wdouble-promotion -Wshorten-64-to-32 is not added for clang builds; the qmake code path did never enforce that on CI machines (it was non-Apple clang only), and the check currently fails on these configurations. Fixes: QTBUG-82615 Change-Id: I1cd303677b1472116910b6c27748f96436feb35e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake Build: Add QNX 7.1 build supportCristian Adam2020-08-201-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | This commit allows building Qt6's QtBase using QNX 7.1 and a toolchain file which is almost identical to what CMake has in its documentation: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-qnx set(CMAKE_SYSTEM_NAME QNX) set(arch gcc_ntoarmv7le) set(CMAKE_C_COMPILER qcc) set(CMAKE_C_COMPILER_TARGET ${arch}) set(CMAKE_CXX_COMPILER q++) set(CMAKE_CXX_COMPILER_TARGET ${arch}) set(CMAKE_SYSROOT $ENV{QNX_TARGET}) The only difference is the usage of q++ instead of QCC, which is no longer present in QNX 7.1 SDK. Task-number: QTBUG-83202 Change-Id: I51031540721275f2ee83cee9e7df4994a65db0e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -qreal <type>Joerg Bornemann2020-08-191-0/+4
| | | | | | | | | The configure argument -qreal <type> maps to the CMake argument -DQT_COORD_TYPE=<type>. Fixes: QTBUG-83325 Change-Id: I94970f31ccfb241b1dd4f1d9b6cef25d6684dc05 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Split QtBuild.cmake into smaller filesAlexandru Croitor2020-08-141-5805/+36
| | | | | | | | | | | | | | | | | | | | | | | QtBuild.cmake is huge. Split it. Move module, plugin, tools, executables and test related functions out of QtBuild.cmake into separate files. Do the same for many other things too. An additional requirement is that all the new Helpers files only define functions and macros. No global variable definitions are allowed, nor execution of commands with side effects. Some notes: qt_install_qml_files is removed because it's dead code. Some functions still need to be figured out, because they are interspersed and depend on various global state assignments. Task-number: QTBUG-86035 Change-Id: I21d79ff02eef923c202eb1000422888727cb0e2c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow opting out of global target promotionAlexandru Croitor2020-08-131-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The endless saga of fighting with qt_find_package and global target promotion. In certain scenarios we want to opt out of target promotion to global scope. One such case is in qttools with WrapLibClang and Threads::Threads. Threads::Threads will be found in the top-level scope via Qt6Dependencies. WrapLibClang is declared in src/ directory scope, and then we try to promote it ands its dependencies to the global scope, via qt_find_package() -> qt_find_package_promote_targets_to_global_scope(). This fails because we can't promote Threads::Threads due to it being added in a different subdirectory scope. Introduce 2 new functions. qt_internal_should_not_promote_package_target_to_global and qt_internal_disable_find_package_global_promotion. The first one is used to disable promotion of targets to global scope in qt_find_package. To mark a target not to be promoted, the second function is used. It will be used by qttools for the WrapLibClang case. Task-number: QTBUG-85877 Change-Id: If6caf10a94999402026517a623ae29e3ab1eeb7f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow specifying a sysconfdir that's outside the prefixAlexandru Croitor2020-08-131-10/+17
| | | | | | | | | Also use the value to actually write it into qconfig.cpp so that qmake reports the right information. Change-Id: Icc4bf36b0dc6ad75d93ac16f39e5b361c0ce52b4 Fixes: QTBUG-81289 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix empty value of CMAKE_SIZEOF_VOID_P when looking for toolsAlexandru Croitor2020-08-131-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our initial approach to looking for host Qt tools when cross-compiling to a platform with a different architecture bitness compared to the host one was to unset CMAKE_SIZEOF_VOID_P before calling find_package(Qt6FooTools) and then restoring the value. That works to bypass the architecture bitness test in the ConfigVersion files, but it also influences the paths that find_package() searches in, specifically the lib<arch> paths like /usr/lib64 will not be searched in. Fortunately since CMake 3.14, write_basic_package_version_file() can take an additional ARCH_INDEPENDENT parameter. This disables the architecture bitness test when looking for the package, while allowing to still search in the /usr/lib64 like paths. Use it when creating the QtFooToolConfigVersion.cmake files. One could argue we should actually check if the tool executables could run on the host system where find_package is called for cross-compilation. We could do that in another change if the problem ever arises. Amends 03aa74e40d8f1270e1bb28d0791e5bc376ffa0b7 Amends 914b367c7f6a117130b8a56338c46a8102a1f77f Change-Id: I1181ff637ac80064a6a8538170b28a41743fc90c Fixes: QTBUG-81672 Reviewed-by: Christophe Giboudeaux <christophe@krop.fr> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Write QMAKE_MACOSX_DEPLOYMENT_TARGET to qconfig.priJoerg Bornemann2020-08-131-0/+2
| | | | | | | | | | | | | If the user specified CMAKE_OSX_DEPLOYMENT_TARGET=10.15 for the Qt build then building projects with qmake failed, because the mkspec hard-codes QMAKE_MACOSX_DEPLOYMENT_TARGET to 10.14. We now write QMAKE_MACOSX_DEPLOYMENT_TARGET to qconfig.pri to override the mkspecs' default. Fixes: QTBUG-85923 Change-Id: I6a39cfe047ac0f99e1da0ca0728d63c741bd4fed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add missing newline at the end of qconfig.priJoerg Bornemann2020-08-131-1/+1
| | | | | Change-Id: I929d74234b685bf0684d3067f7f958d474df20ff Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix Threads::Threads dependency handling with CMake < 3.18Alexandru Croitor2020-08-121-0/+20
| | | | | | | | | | | | | | | | | | | | Apparently CMake encods targets from different scopes with a different encoding scheme for earlier CMake versions. CMake 3.16.3: Threads::Threads::@<0x5604cb3f6b50> CMake 3.18.0: ::@(0x5604cb3f6b50);Threads::Threads;::@ Handle the earlier version approach as well. It needs to be done both when writing out 3rd party dependencies, as well as for lib prl files. Possibly in more places as well, but I didn't detect additional places yet. Amends 92ee9bd6b885879090ba57e49c8bd84a06d42b2b Task-number: QTBUG-85801 Task-number: QTBUG-85877 Change-Id: Ib348b51b2d623fb50d9080dba2beeb931d47a69c Reviewed-by: Cristian Adam <cristian.adam@qt.io>