34 Commits

Author SHA1 Message Date
Joerg Bornemann
b330de576f CMake: Don't enable ASM language
Enable ASM only for non-Android Unix.

Pick-to: 6.5 6.8 6.9
Change-Id: I435ab55f7daf190ce7be5f8eb80b0c1e43b90d94
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-05-08 14:43:18 +02:00
Alexey Edelev
13a7e25f5d Avoid collecting dependencies from modules that were explicitly skipped
If either -skip <module> or BUILD_<module>=OFF is set from command line
we should avoid processing the module dependencies and exclude it from
the list of modules that needs to be build.

Pick-to: 6.7
Change-Id: Ieec8db085221cc4abd5d8ac83c06ecce25d5d4b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-03-22 11:20:31 +01:00
Alexandru Croitor
2c9664ca33 CMake: Integrate init-repository with the configure script
Calling configure will now implicitly run init-repository when
appropriate. See further down below for what "appropriate" means.

All supported init-repository options can be passed to configure as
except for -mirror, -oslo, -berlin.

This includes useful options like -submodules, -no-resolve-deps and
-no-optional-deps.

When running configure on a qt5.git clone without any submodules
cloned, configure will exit with a helpful error message suggesting to
pass -init-submodules, so it automatically clones missing repositories.
This means cloning is opt-in, so that internet access is not done
implicitly.

The error message also suggests passing the -submodules option.
This will affect which submodules will be cloned by init-repository
and which submodules will be configured by configure.
In this case -submodules is effectively an alias of
init-repository's -module-subset for cloning purposes.

When calling configure a second time, without -init-submodules, on an
already configured repo, init-repository behavior is entirely skipped.

-submodules now accepts init-repository-style special values like
"essential", "addon", "all", "existing", "-deprecated" for the purpose
of cloning submodules. The values are then translated into actual repos
that should also be configured or skipped by configure.

The default subset of cloned submodules is currently the same one as
init-repository, "default", which clones 44 actively maintained
repositories as well as deprecated submodules.

If configure is called a second time WITH -init-submodules, it's the
same as calling init-repository --force to re-initialize submodules.
In this case passing something like
 --submodules existing,<additional-submodules>
might make sense to add or remove submodules.

As a drive-by this also fixes the bug where you couldn't pass a
  configure -- -DFOO=0
parameter to configure, because it got treated as '0>', redirecting
from a different stream than stdout, leading to empty content in the
file.

[ChangeLog][General][Build System] The configure script now implicitly
calls init-repository when appropriate and accepts init-repository
command line options.

Fixes: QTBUG-120030
Task-number: QTBUG-122622
Change-Id: Iedbfcbf0a87c8ee89e40d00b6377b68296a65a62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-28 06:24:02 +01:00
Alexey Edelev
4f2674dce6 Suggest the correct switch to skip repo when configuring Qt
Add -DBUILD_<repo>=OFF suggestion for the cases when configuring Qt
using CMake and the repo dependecies are missing.

Change-Id: Iaa370b49e8fd634bebb7c8300d076165c51dec5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-12 11:08:28 +01:00
Alexandru Croitor
29e674d299 CMake: Move some code back into qtbase
It's somewhat painful to do changes in the top-level CMakeLists.txt
in regards to calling qtbase commands, because the file needs to be
compatible with different qtbase sha1s while the submodule update
catches up with a new qtbase to be used for qt5.git.

Use the commands defined in the new QtBaseTopLevelHelpers.cmake file to
to move some responsibility back to qtbase.

This way we can hopefully avoid some churn and do direct changes in
qtbase instead.

Pick-to: 6.6
Task-number: QTBUG-112957
Change-Id: Id897a9f7da366b00a0780a2475b1fb5772bbe8bc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-09-20 08:29:08 +02:00
Alexandru Croitor
cbb50f2e0b CMake: Remove unused variable
Pick-to: 6.5 6.6
Change-Id: I8f79797428226b376a21813c91c87b5bfe8b390b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-05 18:29:18 +02:00
Alexandru Croitor
c971db7e5b CMake: Don't load QtAutoDetect for top-level standalone tests
We don't load it for qtbase standalone tests, we shouldn't for
top-level builds as well.

This brings us one step closer to fixing top-level standalone tests.

Pick-to: 6.5 6.6
Change-Id: I7c2710e61951f6789fea63422bc575a1ac611cdc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-07-08 08:49:19 +02:00
Amir Masoud Abdol
bb13b7dadf Show an error when a submodule is missing, or misspelled
Stop the configuration and show an error if one of the submodules is
missing, or misspelled in `-submodules` option.

Pick-to: 6.5 6.6
Fixes: QTBUG-114133
Change-Id: I890d4f5f0614288a2be422f839e04a0086a58403
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor (OOO) <alexandru.croitor@qt.io>
2023-06-12 12:10:23 +00:00
Amir Masoud Abdol
d3460c1f23 Enable CMAKE_MESSAGE_CONTEXT_SHOW
This enables the CMake Message Context across the qt5 repo. Some of the
messages were changed from NOTICE to STATUS so that the output looks
more coherent and aligned.

Change-Id: I4c9104479dd2af31da29cf8cfd20fdc77252d404
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-26 08:20:01 +02:00
Amir Masoud Abdol
a427b5203b Sync CMake Version with qtbase/CMakeLists.txt
Syncing a few hard-coded versions that we have, to all have the
upper-bound of 3.21.

Change-Id: If8428f850d2df9767a359481db2b7b836843eca5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-26 06:19:47 +00:00
Amir Masoud Abdol
a99e917f88 Remove an unnecessary quotation in loading a CMake module
This isn't a variable, so it shouldn't really be necessary, unless I'm
missing something.

Change-Id: I24c31d1408c1445684b55dd3b87036b57f20b8e4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-10-21 14:45:34 +02:00
Joerg Bornemann
96be84d703 CMake: Take custom libdir into account
When configuring with -libdir set to something that is not recognized
by CMake's find_package search procedure, top-level builds failed to
configure.  This was due to a hard-coded lib/cmake directory added to
CMAKE_PREFIX_PATH.

Fixes: QTBUG-103823
Pick-to: 6.2 6.3 6.4
Change-Id: If8b48e35e654089f32cbe4af9936238cd82b3dbb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-16 09:28:52 +02:00
Alexandru Croitor
30068f2223 CMake: Normalize submodule names by stripping tqtc- prefixes
In tqtc repos, the dependencies.yaml files may point to tqtc- prefixed
repos, which can lead to build failures when doing a top-level build
and the local repo directory names have no tqtc- prefix.

This is the case both in the CI, and when using init-repository or
git submodule init --recursive, because qt5.git specifies the 'path'
key for each submodule to not contain any tqtc- prefix.

Normalize the repo names by removing the tqtc- prefix when doing
dependency resolution for CMake add_subdirectory calls, if such a
submodule name does not exist on-disk.
The normalization is conditional, to allow inclusion of repos that
don't have a non-tqtc mirror.

qt_internal_sync_to and the other git related operations
are currently broken (both before and after this change) when
used in conjunction with tqtc- repos and is non-trivial to fix.

The first problem is the assumption of using the 'origin' remote,
which will likely be an open-source repo that doesn't contain
any tqtc repos.

The second problem is that we would need to agree upon requiring
2 remotes, one open source and one tqtc one, to reliably choose
where to clone / fetch from, as well as determining whether
the checked out repo name needs to have a tqtc- prefix
(by checking whether the repo does not exist in the open source
remote for commercial only repos).

Alternatively we could hard code a list of known open source repos,
and anything not in the list will have its tqtc- prefix kept, but we
still need to know which remote to use.

As a drive-by, adjusted some of the shown messages for better
readability and easier grepping.

Pick-to: 6.2 6.3
Fixes: QTBUG-102883
Change-Id: I6806b119dd32b14dc0d9711dc829bfc5130d1e6f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-28 19:27:59 +02:00
Fabian Kosmale
14e486a8c4 Set QT_SUPERBUILD early
That will allow qtbase's .cmake.conf to check whether it is meant to be
used in a superbuild or only for qtbase.

Task-number: QTBUG-101640
Pick-to: 6.2 6.3
Change-Id: I035c86f32497004cc1b8441456604106bacadad4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-18 12:18:54 +01:00
Joerg Bornemann
8a94d1e294 CMake: Rework inter-repository dependency resolution
In certain cases the dependency resolution between Qt repositories
resulted in a wrong order, for example qtsvg being handled before
qtbase.  See the linked task for an example.

Replace the existing algorithm with a post-order traversal of the
dependency graph to produce a topological ordering.

Rename qt_internal_add_module_dependencies to
qt_internal_resolve_module_dependencies and remove unnecessary
positional arguments.  Use keyword arguments for a nicer API.

Raise the cmake_policy in QtSynchronizeRepo.cmake to avoid policy
warnings we now would get due to the use of IN_LIST.

Fixes: QTBUG-98268
Change-Id: I1425fd9c802fa71ae42549ceb14bcfc4c0a62078
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-31 11:10:40 +01:00
Alexandru Croitor
4180e9c511 CMake: Remove CMake minimum version check in top-level project
The check is done in qtbase instead.

Trying to do it in the top-level project is cumbersome due to needing
to know whether it will be a static or shared Qt build.

It's also cumbersome because the top-level build used to use qtbase's
minimum cmake version values and that can get awkward to handle with
submodule dependency updates.

Replace the check with a regular minimum required call.
The minimum version is 3.16 and the upper range value for NEW policy
assignments is 3.20, while 3.21.0 is still kind of fresh and has some
AUTOUIC issues.

As a drive-by, add a clarifying comment about QtAutoDetect.cmake.

Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: Ifb4ec0b4ed7f56ab0179feb79072c93d1d66ce63
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-27 10:21:11 +02:00
Alexandru Croitor
002b6f075c CMake: Use qtbase's version as the top-level project version
This avoids the need to bump the qt5.git project version when
branching the next minor Qt version.

Pick-to: 6.1 6.0
Task-number: QTBUG-92861
Change-Id: Ib20ab614caefece00bd9e0172d9269077239ba6a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-15 13:27:10 +02:00
Tor Arne Vestbø
4a9d291ca6 Cache list of submodules
Otherwise running cmake with QT_BUILD_SUBMODULES set in the environment
would not persist for later cmake runs without the environment set,
resulting in trying to reconfigure with every single available module.

Change-Id: I85e57b16fdc8e51cae8fff083c7a7536b0ed16f1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-13 14:19:04 +02:00
Tor Arne Vestbø
c746f27e17 cmake: Allow specifying list of submodules using environment
The variable now has a QT prefix to make it less likely to
clash with other environment variables. For simplicity we
use the same variable name internally.

Change-Id: I4c8b1a43ae1facc2e33ae3cd21a8f6b43a437a9b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-30 13:19:56 +01:00
Joerg Bornemann
81096b44bb Do not error out on missing optional repository dependencies
Read the 'required' value from dependencies.yaml and store all required
dependencies of repository 'qtfoo' in a global property
QT_REQUIRED_DEPS_FOR_qtfoo.

Check this property in the top-level CMakeLists.txt and only print
informational messages instead of errors for optional dependencies.

Fixes: QTBUG-91144
Change-Id: I0e1b84a70221857cebba1b9a27456ad3667bfe3a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-12 16:03:03 +01:00
Paul Wicking
b0325dc0eb Bump version
Task-number: QTQAINFRA-4126
Change-Id: Iafa83105ecceaa1c520c941314cb33449ef8ed54
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2021-01-07 14:30:11 +01:00
Alexey Edelev
0393017610 CMake: Fix fuzzer-no-link check for super builds
Add platform detection before report enties evaluation in root
CMakeLists.txt. QtPlatformSupport.cmake defines required
platform-specific variables line CLANG before
qt_configure_eval_commands call.

Fixes: QTBUG-88496
Change-Id: I13afdbe29f2bffeb2c36c17e231b98b2aa2b41e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2020-11-19 12:57:58 +01:00
Alexey Edelev
c7c8d1e064 CMake: Check module dependency before configure
Move all modules dependency check before actual configuration of
any module.

Change-Id: I40838ab59de1be1cd8ca3a006e195455f2692982
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-16 12:56:01 +01:00
Alexey Edelev
a2683113e2 CMake: Fix dependency handling when module is skipped
Put dependencies of all modules to top-level variables and
check for unmet dependencies before module configuring.

Fixes: QTBUG-88214
Change-Id: I089feb474687652f3f8fd1bb1959179ea1114983
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-14 13:10:30 +00:00
Volker Hilsheimer
da25b7f149 Use dependencies.yaml to order sub modules
Don't rely on .gitmodules, instead parse the dependencies.yaml file from
every subdirectory with a CMakeLists.txt, and sort all projects based
on that data. Projects with no dependencies are added last.

This allows us to get rid of the duplication of dependency information
in .gitmodules, and makes each module the authoritative source of its
own dependencies.

Change-Id: Ib1ec6c63bde2aa1852399d598dac5b8e1efda31d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-11 11:44:25 +01:00
Alexandru Croitor
28be349bd7 CMake: Bump the minimum required CMake version to 3.18
This is the top-level counterpart change that uses the infra
introduced in qtbase.

Task-number: QTBUG-88086
Change-Id: I2524cd88da43cffb2b3742caedd1cd2f3130dff5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-11-06 17:17:21 +01:00
Alexandru Croitor
7ccc1420f2 CMake: Deduplicate qtbase source path references
Change-Id: I857d97c3844ab0a9fe728a499aac1ecd07a1c779
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-11-06 17:17:21 +01:00
Joerg Bornemann
eaf64a222f CMake: Run auto-detection routines before any project command
This is needed to ensure that the auto-detection runs before any
toolchain file is loaded, like in a stand-alone qtbase build.

This fixes the issue that we had to specify ANDROID_STL=c++_shared in a
top-level build, even though it's properly defaulted in
QtAutoDetect.cmake.

Task-number: QTBUG-87309
Change-Id: I8ced2213ca2e5a877bfd210e59da4ef4d6c8ac74
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-12 18:28:10 +02:00
Joerg Bornemann
70dc8438fc CMake: Fix find_package puzzle piece of top-level cross-builds
The subdirectories, the top-level CMakeLists.txt adds, contain
find_package(Qt6 COMPONENTS ...) calls. When cross-compiling to Android,
the toolchain file sets CMAKE_FIND_ROOT_PATH and
CMAKE_FIND_ROOT_PATH_MODE to ONLY. That means, the packages that are
created in qtbase can never be found by other Qt repositories, e.g.
qtdeclarative.

Append the qtbase build dir to CMAKE_FIND_ROOT_PATH to find the Qt
packages of the build dir when cross-compiling. Because of some CMake
idiosyncracy, we need to append "${QtBase_BINARY_DIR}/lib/cmake" to
CMAKE_PREFIX_PATH and not just "${QtBase_BINARY_DIR}". See
qtbase/ec90f9013b4c6b63d7e03a964f66f97329be7885 for details.

Task-number: QTBUG-85080
Change-Id: I799f851316538c310d73f5ab59c809229e16e8a8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-12 18:28:10 +02:00
Joerg Bornemann
643172a8df CMake: Remove ${CMAKE_BINARY_DIR} from CMAKE_PREFIX_PATH
This is a left-over from before the bin, lib, ... directories were moved
to the qtbase build directory.

Change-Id: I24bfa36289648288b2b44cc809e0c390cd2c043b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-11 14:26:59 +02:00
David Edmundson
c416b79407 Cmake: Include 3rdparty cmake dependencies in CMAKE_MODULE_PATH
QtWayland looks for WaylandScanner. If QtBase is installed our CMake
find files will be installed and everything will work correctly.

If QtBase is not installed yet or out of date, we need to add our source
cmake files to the search path. We currently add one of the 3rd party
directories, but not the subdirectories.

Change-Id: I53ce26b5b21b7e5e74752c730bca90295147f851
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-09-10 09:54:47 +01:00
Alexandru Croitor
43b7a3693e CMake: Fix parsing of .gitmodules to be more robust
Fix empty lines in .gitmodules, rather than failing to configure
with an error message that the line is malformed.

Quote all relevant values, to avoid errors that string REGEX does
not have enough arguments in cases when the parsed content is
malformed.

Remove some dead code.

Change-Id: I300a76f82fe174290442c659ca2e84391db361a1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-06-18 12:57:51 +02:00
Leander Beernaert
0739a54a4b Read module list from .gitmodules
This patch mimics the behavior of qt.pro, where the module list is
extracted from the .gitmodules file and then topologically sorted
based on the modules dependencies.

This patch also introduces a small check to make sure all the required
dependencies are met and will be built.

Change-Id: Idd3df9b618805ca0b2347eac57aaa39c1bcdb3dd
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b01225fb32)
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-03-18 21:26:26 +01:00
Kevin Funk
a59826003e Start the CMake superbuild
Also import and use ECMOptionalAddSubdirectory.cmake to add other
module's as subdirectories, in case the directories exist. Additionally
this module allows to disable the build of submodules by passing e.g.
BUILD_qtsvg=OFF.

This probably needs more though on how to hande the intermodule dependencies,
but it's a start.

Task-number: QTBUG-75582
Change-Id: Ic3de9711d9b865b2d96bdaee0089f570408b9693
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit 7509458d5f)
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-18 21:26:20 +01:00