summaryrefslogtreecommitdiffstats
path: root/cmake/QtQmakeHelpers.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Fix line endings of wrapper scriptsJoerg Bornemann2022-05-171-1/+3
| | | | | | | | | | | | | | | If QT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS is ON then we generate Windows scripts on Unix and vice versa. We always used the host platforms line endings for generating the scripts. This leads to Windows line endings in Unix scripts and vice versa. Explicitly specify the line endings style when generating wrapper scripts. Fixes: QTBUG-102747 Pick-to: 6.2 6.3 Change-Id: I1603add46f276a5d91bbf0f103a261cdd84c343b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: also allow building tools when found elsewhere in host buildsThiago Macieira2022-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, this was only supported when cross-compiling, but that's an unnecessary limitation. Instead, make it possible to build the "host" tools (notably qmake) even when they've been found elsewhere due to QT_FORCE_FIND_TOOLS=ON and a supplied QT_HOST_PATH. The combination of QT_FORCE_FIND_TOOLS and QT_FORCE_BUILD_TOOLS set to ON is useful for developers who touch content that ends up in the bootstrap library. QT_BUILD_TOOLS_WHEN_CROSSCOMPILING is deprecated in favor of QT_FORCE_BUILD_TOOLS. [ChangeLog][CMake] QT_BUILD_TOOLS_WHEN_CROSSCOMPILING has been deprecated in favor of QT_FORCE_BUILD_TOOLS. The latter can be used in combination with QT_FORCE_FIND_TOOLS and QT_HOST_PATH to use tools from a host Qt even for a non-cross build and still build the tools. Fixes: QTBUG-99683 Change-Id: I0e5f6bec596a4a78bd3bfffd16c8fb486181f9b6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Embed an empty qt_prfxpath if Qt is relocatableAlexandru Croitor2022-04-221-5/+12
| | | | | | | | | | | | | | | | | | | When Qt is configured as relocatable, QT_CONFIGURE_PREFIX_PATH_STR -> qt_configure_prefix_path_str -> qt_prfxpath is not used in relevant code paths. Specifically qlibraryinfo.cpp getPrefix() uses getRelocatablePrefix() instead of QT_CONFIGURE_PREFIX_PATH. Thus, when Qt is configured as relocatable, set qt_prfxpath to an empty string. This avoids embedding a CI path like /home/qt/work/install into the official packages, which makes reproducible builds a closer reality. Change-Id: I9209b08e651ad0b7fdc4049df333e0978e05f1f5 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CMake: Generate wrapper shell scripts for all hosts when requestedAlexandru Croitor2022-03-041-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | This is useful for Qt for Android builds, where we want to build Qt on a single host, but make the Qt installation usable on any host (Windows, Linux, macOS). There are only two flavors of shell scripts, unix ones that use sh and Windows batch files. If Qt is configured with -DQT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS=ON then we generate both of them regardless of the current host platform. Note that the target_qt.conf file still needs to be patched to specify a correct HostSpec value so that qmake operates correctly. Other target_qt.conf values might also need path adjustments depending on use case (like HostPrefix and HostData). Pick-to: 6.2 6.3 Task-number: QTBUG-101357 Change-Id: Ic86caaa8b318467528cc82dc7fbfecde998cdb71 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Provide a qtpaths wrapper script when cross-building QtJoerg Bornemann2021-11-081-15/+17
| | | | | | | | | | | | | The qtpaths tool is supposed to replace "qmake -query", and it must be available for cross-builds as a wrapper script like qmake. Re-use the existing facility for creating the qmake wrapper script for creating the qtpaths wrapper script. Pick-to: 6.2 Fixes: QTBUG-97821 Change-Id: I460bae61a531994422e1c0fba09c79e4aa65713f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake/qconfig.cpp: use raw strings so we support any inputThiago Macieira2021-11-041-12/+12
| | | | | Change-Id: I2bbf422288924c198645fffd16aa04379315e69e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qconfig.cpp: use qOffsetStringArrayThiago Macieira2021-10-291-25/+12
| | | | | | | | | | It's been there for ages, we may as well use it and remove unnecessary complexity from CMake. Pick-to: 6.2 Change-Id: I2bbf422288924c198645fffd16a9742567a7e4af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Only write device prefix to target_qt.conf if necessaryJoerg Bornemann2021-09-281-1/+3
| | | | | | | | | | | | | | | | The device prefix in target_qt.conf is necessary if and only if the prefix on the host is different from the prefix on the device - in CMake terms: if CMAKE_STAGING_PREFIX is different from CMAKE_INSTALL_PREFIX. This removes the [Devices] section from target_qt.conf from our iOS and Android packages, because we don't set CMAKE_STAGING_PREFIX for those platforms. Pick-to: 6.2 Fixes: QTBUG-96906 Change-Id: I1390e952e544e57d5dd3bc09d688a612db9b4247 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Replace usage of WIN32 with CMAKE_HOST_WIN32 in qconfig.cppAlexandru Croitor2021-08-171-1/+1
| | | | | | | | | | | | | The workaround of adding a drive letter to QT_CONFIGURE_PREFIX_PATH_STR should be done when running on any Windows host, not only when targeting Windows. Amends 59c3be711728ab0aa644bfdf50e91a1b020f95bb Pick-to: 6.1 6.2 Task-number: QTBUG-87580 Change-Id: Ic6ca50aa58a4a54fb483e90fe61a907fe86cb002 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix QT_HOST_DATA for builds setting INSTALL_MKSPECSDIRJoerg Bornemann2021-06-231-6/+0
| | | | | | | | | | | | | | | | | | | | In a Qt build that was configured with INSTALL_MKSPECSDIR set to something different than INSTALL_DATADIR, the qmake property QT_HOST_DATA was wrong. Consequently, mkspecs could not be loaded, rendering qmake dysfunctional. The reason was that we considered every QT_HOST_xxx property to have the same value as QT_INSTALL_xxx in a non-cross build. This is not true for QT_HOST_DATA, because users might want to set INSTALL_DATADIR to "foo" but INSTALL_MKSPECSDIR to "bar/mkspecs". Move the unused determination of the host data dir to the QtLibraryInfo lib and handle QT_HOST_DATA specially. Fixes: QTBUG-94591 Pick-to: 6.2 Change-Id: I2c44cda8405ff1d14391254fcd1d9b1361cb5855 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix qconfig.cpp embedded prefix in the CIAlexandru Croitor2021-03-251-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the CI on a windows we configure Qt with the following prefix -DCMAKE_INSTALL_PREFIX:PATH=\Users\qt\work\install Note the lack of the drive letter. This is intentional, so that we can abuse CMake's DESTDIR installation mechanism to install into a custom path. This causes trouble for static Qt builds in the CI. Specifically when there is no qt.conf file next to qmake, qmake -query will report a QT_INSTALL_PREFIX:/Users/qt/work/install and ultimately qmake will fail to locate the module .pri files in such a path, showing errors like: Project ERROR: Unknown module(s) in QT: core gui? If a qt.conf is placed next to qmake (even an empty one), a differenct code path is used in qmake to resolve the prefix, which returns a path with a drive letter. In a shared build, because the 'relocatable' feature is enabled by default, a different code path is used and thus the prefix is also successfully resolved. So the problem is specific to static Windows Qt builds that have no qt.conf file next to qmake. This is the exact scenario that we encounter when running static Qt tests (tst_qmake in particular). To circumvent the issue, prepend a drive letter to the prefix hardcoded into qconfig.cpp. Do that with get_filename_component(REALPATH) which apparently resolves to a fully qualified path. Pick-to: 6.1 Task-number: QTBUG-87580 Change-Id: I17c885f29bfdee45bec1d6aac7c3b26723e761a3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove all qmake-related data from q[make]config.cppJoerg Bornemann2021-03-111-13/+0
| | | | | | | | | | | | Now that we're not actually using qmakeconfig.cpp anymore, we can remove it together with all qmake-related information that was written into qconfig.cpp. This also moves the qtConfEntries array back to qlibraryinfo.cpp. Change-Id: I5e57d8c55613332cc3e57b11df4398d46aed259b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Pass target and host mkspec as defines to QMakeLibraryInfoJoerg Bornemann2021-03-111-2/+0
| | | | | | Change-Id: If07055286496c507310c0dbb3a06f1a42d643596 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Do not write Sysroot and SysrootifyPrefix into qmakeconfig.cppJoerg Bornemann2021-03-111-2/+0
| | | | | | | | Those have fixed values. Change-Id: I7f1ba8036f43413d3c805f4b419ae79e037343fb Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Simplify prefix-related functionality of qmakeAlexey Edelev2021-03-011-9/+0
| | | | | | | | | | | | | Since the QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH and QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH definitions keep the same value in modern CMake build, no need to have special handling in cases where these values are used in qmake. Also it will be useful to specify the relative path to the prefix directory from the directories different of 'bin' when use QMakeLibraryInfo. Task-number: QTBUG-75870 Change-Id: I5a777001eb334dcf05e22853a514d4257352d59b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use Core library for qmake instead of the Bootstrap libraryAlexey Edelev2021-02-251-2/+2
| | | | | | | | | | | | | | | | | | | 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>
* qmake: Introduce QT_HOST_LIBEXECS propertyJoerg Bornemann2021-02-181-0/+1
| | | | | | | | | This will be used to access host tools that are installed in ${prefix}/libexec instead of ${prefix}/bin. Pick-to: 6.1 Change-Id: I36c4b5736330f8229d267a117c65d55cd5e12758 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Do not write Effective[Source]Paths to target_qt.confJoerg Bornemann2020-12-081-17/+0
| | | | | | | | | | This was needed, when the mkspecs directory was not present in the non-prefix build directory. That's not the case anymore. Pick-to: 6.0 Fixes: QTBUG-89182 Change-Id: I2b04c2d857b0af324e1d7c41ed1934a62275d6f1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Remove outdated TODO commentsJoerg Bornemann2020-10-301-2/+2
| | | | | | | | We do not have host-specific INSTALL_*DIR variables in the CMake build. It is equivalent to a qmake build with host prefix = prefix. Change-Id: I65731e6038508b6c28e3f2819b624ba19abfc82a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Write INSTALL_MKSPECSDIR to qconfig.cppJoerg Bornemann2020-10-301-1/+7
| | | | | | | | | The value of this variable - whithout the mkspecs part - is what's called the host data dir in Qt5. Fixes: QTBUG-87681 Change-Id: I3dfeed17e8a614476aef4d9c651a141ce62e6551 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix automatic sysrootification detection for qmakeAlexandru Croitor2020-10-261-10/+16
| | | | | | | | | | | | | | | | | | | | | The way we detected whether SysrootifyPrefix needs to be set was incorrect. We checked if extprefix == prefix => SysrootifyPrefix should be true. But that was previously always the case for a non-prefix build, which means it was not possible to build apps (due to qmake expecting to find include dirs in the sysroot, despite the non-prefix Qt not being installed anywhere into the sysroot). Instead we should do what qmake does. Only set SysrootifyPrefix to true if extprefix was not provided and a sysroot is available. To make it work for iOS and Android, the sysroot detection code had to be moved earlier than the SysrootifyPrefix detection. Task-number: QTBUG-86053 Change-Id: Idcc1260a675fb2ef9ae27fc9dc42a68b30f763b8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix creation of host-qmake wrapper when cross-compilingAlexandru Croitor2020-08-231-1/+2
| | | | | | | | | The -host prefix was added to the 'preliminary' directory rather than the actual wrapper shell script. This caused it to be overwritten every time by the cross-compiled qmake binary. Change-Id: I103811c6aa9181fa701e3e7ecaf828ecdd1e3c90 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Handle -D, -I, -F and -L configure argumentsJoerg Bornemann2020-08-171-0/+15
| | | | | | | | | | | | | | Introduce new CMake variables and map -D to QT_EXTRA_DEFINES, -I to QT_EXTRA_INCLUDEPATHS, -L to QT_EXTRA_LIBDIRS, and -F to QT_EXTRA_FRAMEWORKPATHS. Those variables only affect the Qt build, not user projects. Fixes: QTBUG-85878 Change-Id: I229df2eed1505a2619068d0d32975962b052569a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Split QtBuild.cmake into smaller filesAlexandru Croitor2020-08-141-0/+208
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>