2021-07-21 17:41:57 +02:00
|
|
|
# The real minimum version will be checked by the qtbase project.
|
|
|
|
# 3.16 is the absolute minimum though.
|
2022-10-24 11:20:22 +02:00
|
|
|
cmake_minimum_required(VERSION 3.16...3.21)
|
2020-11-02 09:02:58 +01:00
|
|
|
|
2022-03-18 12:02:17 +01:00
|
|
|
# set QT_SUPERBUILD early, so that qtbase/.cmake.conf can check it
|
|
|
|
set(QT_SUPERBUILD TRUE)
|
|
|
|
|
2021-07-21 17:41:57 +02:00
|
|
|
# Include qtbase's .cmake.conf for access to QT_REPO_MODULE_VERSION
|
|
|
|
set(__qt6_qtbase_src_path "${CMAKE_CURRENT_SOURCE_DIR}/qtbase")
|
2020-11-02 08:53:35 +01:00
|
|
|
include("${__qt6_qtbase_src_path}/.cmake.conf")
|
2023-08-28 12:12:43 +02:00
|
|
|
include("${__qt6_qtbase_src_path}/cmake/QtBaseTopLevelHelpers.cmake")
|
2019-06-06 22:42:18 +02:00
|
|
|
|
2023-08-28 12:12:43 +02:00
|
|
|
qt_internal_top_level_setup_autodetect()
|
2020-10-09 11:50:41 +02:00
|
|
|
|
2019-06-06 22:42:18 +02:00
|
|
|
project(Qt
|
2021-04-15 12:45:41 +02:00
|
|
|
VERSION "${QT_REPO_MODULE_VERSION}"
|
2019-06-06 22:42:18 +02:00
|
|
|
DESCRIPTION "Qt Libraries"
|
|
|
|
HOMEPAGE_URL "https://qt.io/"
|
2025-04-30 15:41:54 +02:00
|
|
|
LANGUAGES CXX C
|
2019-06-06 22:42:18 +02:00
|
|
|
)
|
|
|
|
|
2025-04-30 15:41:54 +02:00
|
|
|
if(UNIX AND NOT ANDROID)
|
|
|
|
enable_language(ASM)
|
|
|
|
endif()
|
|
|
|
|
2023-08-28 12:12:43 +02:00
|
|
|
qt_internal_top_level_setup_after_project()
|
2019-06-06 22:42:18 +02:00
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
2023-08-28 12:12:43 +02:00
|
|
|
qt_internal_top_level_setup_cmake_module_path()
|
2019-06-06 22:42:18 +02:00
|
|
|
|
2022-10-19 18:56:19 +02:00
|
|
|
include(QtTopLevelHelpers)
|
2019-06-06 22:42:18 +02:00
|
|
|
include(ECMOptionalAddSubdirectory)
|
|
|
|
|
2023-08-28 12:12:43 +02:00
|
|
|
qt_internal_top_level_before_build_submodules()
|
2019-06-06 22:42:18 +02:00
|
|
|
|
2024-03-20 13:39:47 +01:00
|
|
|
qt_internal_find_modules(known_submodules)
|
2020-11-08 14:28:12 +01:00
|
|
|
# Get submodule list if not already defined
|
2021-03-16 16:18:44 +01:00
|
|
|
if(NOT QT_BUILD_SUBMODULES)
|
|
|
|
if(DEFINED ENV{QT_BUILD_SUBMODULES})
|
|
|
|
set(QT_BUILD_SUBMODULES "$ENV{QT_BUILD_SUBMODULES}")
|
|
|
|
else()
|
2024-03-20 13:39:47 +01:00
|
|
|
set(QT_BUILD_SUBMODULES "${known_submodules}")
|
2021-03-16 16:18:44 +01:00
|
|
|
endif()
|
2020-11-08 14:28:12 +01:00
|
|
|
endif()
|
2021-04-13 11:31:50 +02:00
|
|
|
set(QT_BUILD_SUBMODULES "${QT_BUILD_SUBMODULES}" CACHE STRING "Submodules to build")
|
2020-01-08 17:04:43 +01:00
|
|
|
|
2024-03-20 13:39:47 +01:00
|
|
|
# Preliminary check if module should be skipped since -skip <module> or BUILD_<module>
|
|
|
|
# are provided.
|
|
|
|
set(explicitly_skipped_modules "")
|
|
|
|
foreach(module IN LISTS known_submodules)
|
|
|
|
if(DEFINED BUILD_${module} AND NOT BUILD_${module})
|
|
|
|
list(APPEND explicitly_skipped_modules ${module})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2023-06-02 16:21:02 +02:00
|
|
|
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
|
|
|
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${module}/CMakeLists.txt)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"Module '${module}' cannot be found. Please double-check the "
|
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-01-29 18:10:42 +01:00
|
|
|
"spelling and try again. Or run\n"
|
|
|
|
"`./configure -init-submodules -submodules ${module}` "
|
|
|
|
"to clone the submodule and its dependencies.")
|
2023-06-02 16:21:02 +02:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2024-03-20 13:39:47 +01:00
|
|
|
qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES
|
|
|
|
SKIP_MODULES ${explicitly_skipped_modules})
|
2019-06-06 22:42:18 +02:00
|
|
|
|
2021-03-16 16:18:44 +01:00
|
|
|
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
2020-11-13 13:42:42 +01:00
|
|
|
# Check for unmet dependencies
|
|
|
|
if(NOT DEFINED BUILD_${module} OR BUILD_${module})
|
2022-10-25 17:03:01 +02:00
|
|
|
message(STATUS "Checking dependencies of submodule '${module}'")
|
2021-03-12 14:53:23 +01:00
|
|
|
get_property(required_deps GLOBAL PROPERTY QT_REQUIRED_DEPS_FOR_${module})
|
2022-01-21 21:55:08 +01:00
|
|
|
get_property(dependencies GLOBAL PROPERTY QT_DEPS_FOR_${module})
|
|
|
|
foreach(dep IN LISTS dependencies)
|
2020-11-13 13:42:42 +01:00
|
|
|
if (dep STREQUAL "qtbase")
|
|
|
|
# Always available skip
|
|
|
|
continue()
|
|
|
|
endif()
|
2021-03-12 14:53:23 +01:00
|
|
|
|
|
|
|
set(required FALSE)
|
|
|
|
if(dep IN_LIST required_deps)
|
|
|
|
set(required TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(error_reason "")
|
2020-11-13 13:42:42 +01:00
|
|
|
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dep}/CMakeLists.txt")
|
2021-03-12 14:53:23 +01:00
|
|
|
set(error_reason "${dep}'s CMakeLists.txt couldn't be found")
|
|
|
|
elseif(DEFINED BUILD_${dep} AND NOT BUILD_${dep})
|
|
|
|
set(error_reason "building '${dep}' was explicitly disabled")
|
2020-11-13 13:42:42 +01:00
|
|
|
endif()
|
2021-03-12 14:53:23 +01:00
|
|
|
|
|
|
|
if(NOT error_reason STREQUAL "")
|
|
|
|
if(required)
|
2024-02-08 11:22:29 +01:00
|
|
|
if(QT_INTERNAL_CALLED_FROM_CONFIGURE)
|
|
|
|
set(skip_argument "-skip ${module}")
|
|
|
|
else()
|
|
|
|
set(skip_argument "-DBUILD_${module}=OFF")
|
|
|
|
endif()
|
|
|
|
|
2021-03-12 14:53:23 +01:00
|
|
|
message(FATAL_ERROR "Module '${module}' depends on '${dep}', "
|
|
|
|
"but ${error_reason}.\n"
|
2024-02-08 11:22:29 +01:00
|
|
|
"Note: Use '${skip_argument}' to exclude it from the build.")
|
2021-03-12 14:53:23 +01:00
|
|
|
else()
|
2022-10-25 17:03:01 +02:00
|
|
|
message(STATUS "Skipping optional dependency '${dep}' of '${module}', "
|
2021-03-12 14:53:23 +01:00
|
|
|
"because ${error_reason}.")
|
|
|
|
endif()
|
2020-11-13 13:42:42 +01:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2020-11-16 12:35:31 +01:00
|
|
|
endforeach()
|
2020-11-13 13:42:42 +01:00
|
|
|
|
2022-10-25 17:03:01 +02:00
|
|
|
if(NOT DEFINED CMAKE_MESSAGE_CONTEXT_SHOW)
|
|
|
|
set(CMAKE_MESSAGE_CONTEXT_SHOW TRUE)
|
|
|
|
endif()
|
|
|
|
|
2021-03-16 16:18:44 +01:00
|
|
|
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
2022-10-25 17:03:01 +02:00
|
|
|
message(STATUS "Configuring submodule '${module}'")
|
2020-11-08 14:28:12 +01:00
|
|
|
ecm_optional_add_subdirectory("${module}")
|
2019-06-06 22:42:18 +02:00
|
|
|
|
2023-08-28 12:12:43 +02:00
|
|
|
qt_internal_top_level_after_add_subdirectory()
|
2020-01-08 17:04:43 +01:00
|
|
|
endforeach()
|
|
|
|
|
2023-08-28 12:12:43 +02:00
|
|
|
qt_internal_top_level_end()
|