2021-07-21 15:41:57 +00:00
|
|
|
# The real minimum version will be checked by the qtbase project.
|
|
|
|
# 3.16 is the absolute minimum though.
|
|
|
|
cmake_minimum_required(VERSION 3.16...3.20)
|
2020-11-02 08:02:58 +00:00
|
|
|
|
2022-03-18 11:02:17 +00:00
|
|
|
|
|
|
|
# set QT_SUPERBUILD early, so that qtbase/.cmake.conf can check it
|
|
|
|
set(QT_SUPERBUILD TRUE)
|
|
|
|
|
2021-07-21 15:41:57 +00: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 07:53:35 +00:00
|
|
|
include("${__qt6_qtbase_src_path}/.cmake.conf")
|
2019-06-06 20:42:18 +00:00
|
|
|
|
2021-07-21 15:41:57 +00:00
|
|
|
# Run platform auto-detection /before/ the first project() call and thus
|
|
|
|
# before the toolchain file is loaded.
|
2020-11-02 08:02:58 +00:00
|
|
|
include("${__qt6_qtbase_src_path}/cmake/QtAutoDetect.cmake")
|
2020-10-09 09:50:41 +00:00
|
|
|
|
2019-06-06 20:42:18 +00:00
|
|
|
project(Qt
|
2021-04-15 10:45:41 +00:00
|
|
|
VERSION "${QT_REPO_MODULE_VERSION}"
|
2019-06-06 20:42:18 +00:00
|
|
|
DESCRIPTION "Qt Libraries"
|
|
|
|
HOMEPAGE_URL "https://qt.io/"
|
|
|
|
LANGUAGES CXX C ASM
|
|
|
|
)
|
|
|
|
|
|
|
|
# Required so we can call ctest from the root build directory
|
|
|
|
enable_testing()
|
|
|
|
|
2020-01-08 16:04:43 +00:00
|
|
|
set(qt_module_prop_prefix "__qt_prop_")
|
|
|
|
|
2019-06-06 20:42:18 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
if (NOT QT_BUILD_STANDALONE_TESTS)
|
2020-11-02 08:02:58 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${__qt6_qtbase_src_path}/cmake")
|
|
|
|
list(APPEND CMAKE_MODULE_PATH
|
|
|
|
"${__qt6_qtbase_src_path}/cmake/3rdparty/extra-cmake-modules/find-modules")
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${__qt6_qtbase_src_path}/cmake/3rdparty/kwin")
|
2019-06-06 20:42:18 +00:00
|
|
|
endif()
|
|
|
|
|
2020-11-08 13:28:12 +00:00
|
|
|
include("QtTopLevelHelpers")
|
2019-06-06 20:42:18 +00:00
|
|
|
include(ECMOptionalAddSubdirectory)
|
|
|
|
|
|
|
|
# Also make sure the CMake config files do not recreate the already-existing targets
|
|
|
|
if (NOT QT_BUILD_STANDALONE_TESTS)
|
|
|
|
set(QT_NO_CREATE_TARGETS TRUE)
|
|
|
|
endif()
|
|
|
|
|
2020-11-08 13:28:12 +00:00
|
|
|
# Get submodule list if not already defined
|
2021-03-16 15:18:44 +00:00
|
|
|
if(NOT QT_BUILD_SUBMODULES)
|
|
|
|
if(DEFINED ENV{QT_BUILD_SUBMODULES})
|
|
|
|
set(QT_BUILD_SUBMODULES "$ENV{QT_BUILD_SUBMODULES}")
|
|
|
|
else()
|
|
|
|
qt_internal_find_modules(QT_BUILD_SUBMODULES)
|
|
|
|
endif()
|
2020-11-08 13:28:12 +00:00
|
|
|
endif()
|
2021-04-13 09:31:50 +00:00
|
|
|
set(QT_BUILD_SUBMODULES "${QT_BUILD_SUBMODULES}" CACHE STRING "Submodules to build")
|
2020-01-08 16:04:43 +00:00
|
|
|
|
2022-01-21 20:55:08 +00:00
|
|
|
qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES)
|
2019-06-06 20:42:18 +00:00
|
|
|
|
2021-03-16 15:18:44 +00:00
|
|
|
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
2020-11-13 12:42:42 +00:00
|
|
|
# Check for unmet dependencies
|
|
|
|
if(NOT DEFINED BUILD_${module} OR BUILD_${module})
|
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-26 16:02:09 +00:00
|
|
|
message(NOTICE "Checking dependencies of submodule '${module}'")
|
2021-03-12 13:53:23 +00:00
|
|
|
get_property(required_deps GLOBAL PROPERTY QT_REQUIRED_DEPS_FOR_${module})
|
2022-01-21 20:55:08 +00:00
|
|
|
get_property(dependencies GLOBAL PROPERTY QT_DEPS_FOR_${module})
|
|
|
|
foreach(dep IN LISTS dependencies)
|
2020-11-13 12:42:42 +00:00
|
|
|
if (dep STREQUAL "qtbase")
|
|
|
|
# Always available skip
|
|
|
|
continue()
|
|
|
|
endif()
|
2021-03-12 13:53:23 +00:00
|
|
|
|
|
|
|
set(required FALSE)
|
|
|
|
if(dep IN_LIST required_deps)
|
|
|
|
set(required TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(error_reason "")
|
2020-11-13 12:42:42 +00:00
|
|
|
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dep}/CMakeLists.txt")
|
2021-03-12 13:53:23 +00: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 12:42:42 +00:00
|
|
|
endif()
|
2021-03-12 13:53:23 +00:00
|
|
|
|
|
|
|
if(NOT error_reason STREQUAL "")
|
|
|
|
if(required)
|
|
|
|
message(FATAL_ERROR "Module '${module}' depends on '${dep}', "
|
|
|
|
"but ${error_reason}.\n"
|
|
|
|
"Note: Use '-skip ${module}' to exclude it from the build.")
|
|
|
|
else()
|
|
|
|
message(NOTICE "Skipping optional dependency '${dep}' of '${module}', "
|
|
|
|
"because ${error_reason}.")
|
|
|
|
endif()
|
2020-11-13 12:42:42 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2020-11-16 11:35:31 +00:00
|
|
|
endforeach()
|
2020-11-13 12:42:42 +00:00
|
|
|
|
2021-03-16 15:18:44 +00:00
|
|
|
foreach(module IN LISTS QT_BUILD_SUBMODULES)
|
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-26 16:02:09 +00:00
|
|
|
message(NOTICE "Configuring submodule '${module}'")
|
2020-11-08 13:28:12 +00:00
|
|
|
ecm_optional_add_subdirectory("${module}")
|
2019-06-06 20:42:18 +00:00
|
|
|
|
2020-11-08 13:28:12 +00:00
|
|
|
if(module STREQUAL "qtbase")
|
|
|
|
if (NOT QT_BUILD_STANDALONE_TESTS)
|
2022-06-13 09:25:34 +00:00
|
|
|
list(APPEND CMAKE_PREFIX_PATH "${QtBase_BINARY_DIR}/${INSTALL_LIBDIR}/cmake")
|
2020-11-08 13:28:12 +00:00
|
|
|
list(APPEND CMAKE_FIND_ROOT_PATH "${QtBase_BINARY_DIR}")
|
|
|
|
endif()
|
|
|
|
endif()
|
2020-01-08 16:04:43 +00:00
|
|
|
endforeach()
|
|
|
|
|
2019-06-06 20:42:18 +00:00
|
|
|
if(NOT QT_BUILD_STANDALONE_TESTS)
|
|
|
|
# Display a summary of everything
|
|
|
|
include(QtBuildInformation)
|
2020-11-19 11:19:39 +00:00
|
|
|
include(QtPlatformSupport)
|
2019-06-06 20:42:18 +00:00
|
|
|
qt_print_feature_summary()
|
|
|
|
qt_print_build_instructions()
|
|
|
|
endif()
|