Add forwarding of CMake variables to ABI-specific external projects
The 'QT_ANDROID_MULTI_ABI_FORWARD_VARS' variable allows to forward variable values to ABI-specific external projects. The variable accepts names of variables that needs to be forwarded. Pick-to: 6.4 Task-number: QTBUG-107893 Change-Id: Iaa4fa7e98ad0df956d90f91e157edb561183c795 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
84613e0e4c
commit
19ddc0b225
@ -1076,6 +1076,12 @@ function(_qt_internal_configure_android_multiabi_target target)
|
||||
"-DCMAKE_CXX_COMPILER_LAUNCHER=${compiler_launcher}")
|
||||
endif()
|
||||
|
||||
unset(user_cmake_args)
|
||||
foreach(var IN LISTS QT_ANDROID_MULTI_ABI_FORWARD_VARS)
|
||||
string(REPLACE ";" "$<SEMICOLON>" var_value "${${var}}")
|
||||
list(APPEND user_cmake_args "-D${var}=${var_value}")
|
||||
endforeach()
|
||||
|
||||
set(missing_qt_abi_toolchains "")
|
||||
set(previous_copy_apk_dependencies_target ${target})
|
||||
# Create external projects for each android ABI except the main one.
|
||||
@ -1108,6 +1114,7 @@ function(_qt_internal_configure_android_multiabi_target target)
|
||||
"-DQT_INTERNAL_ANDROID_MULTI_ABI_BINARY_DIR=${CMAKE_BINARY_DIR}"
|
||||
"${config_arg}"
|
||||
"${extra_cmake_args}"
|
||||
"${user_cmake_args}"
|
||||
"-B" "${android_abi_build_dir}"
|
||||
"-S" "${CMAKE_SOURCE_DIR}"
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
|
@ -27,6 +27,7 @@ endif()
|
||||
|
||||
# Limit set of tests to run for Android multi-ABI Qt builds.
|
||||
if(QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS)
|
||||
add_subdirectory(cmake)
|
||||
add_subdirectory(corelib/kernel/qmath)
|
||||
add_subdirectory(widgets/effects/qpixmapfilter)
|
||||
add_subdirectory(corelib/platform)
|
||||
|
@ -71,7 +71,8 @@ enable_testing()
|
||||
# flag. Notably -rpath is specified which should implicitly enable -rpath-link, but that
|
||||
# doesn't seem to be the case.
|
||||
# Until this is figured out, disable the tests when cross-compiling to Linux.
|
||||
if(UNIX AND NOT APPLE AND NOT WIN32 AND CMAKE_CROSSCOMPILING AND NOT QT_ENABLE_CMAKE_BOOT2QT_TESTS)
|
||||
if(UNIX AND NOT APPLE AND NOT WIN32 AND CMAKE_CROSSCOMPILING AND NOT QT_ENABLE_CMAKE_BOOT2QT_TESTS
|
||||
AND NOT QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS)
|
||||
message(STATUS "Running CMake tests is disabled when cross-compiling to Linux / Boot2Qt.")
|
||||
return()
|
||||
endif()
|
||||
@ -113,6 +114,43 @@ endif()
|
||||
|
||||
include("${_Qt6CTestMacros}")
|
||||
|
||||
# Test only multi-abi specific functionality when QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS is ON.
|
||||
# Qt::Gui is the prerequisite for all Android tests.
|
||||
if(QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS AND NOT NO_GUI)
|
||||
unset(multi_abi_vars)
|
||||
foreach(abi IN_LISTS QT_ANDROID_ABIS)
|
||||
list(APPEND multi_abi_vars "-DQT_PATH_ANDROID_ABI_${abi}=${QT_PATH_ANDROID_ABI_${abi}}")
|
||||
endforeach()
|
||||
if(QT_ANDROID_BUILD_ALL_ABIS)
|
||||
list(APPEND multi_abi_vars "-DQT_ANDROID_BUILD_ALL_ABIS=${QT_ANDROID_BUILD_ALL_ABIS}")
|
||||
endif()
|
||||
|
||||
list(APPEND multi_abi_vars "-DQT_HOST_PATH=${QT_HOST_PATH}")
|
||||
|
||||
set(multi_abi_forward_vars
|
||||
TEST_SINGLE_VALUE_ARG
|
||||
TEST_SPACES_VALUE_ARG
|
||||
TEST_LIST_VALUE_ARG
|
||||
TEST_ESCAPING_VALUE_ARG
|
||||
)
|
||||
string(REPLACE ";" "[[;]]" multi_abi_forward_vars "${multi_abi_forward_vars}")
|
||||
|
||||
set(single_value "TestValue")
|
||||
set(list_value "TestValue[[;]]TestValue2[[;]]TestValue3")
|
||||
set(escaping_value "TestValue\\\\[[;]]TestValue2\\\\[[;]]TestValue3")
|
||||
set(spaces_value "TestValue TestValue2 TestValue3")
|
||||
_qt_internal_test_expect_pass(test_android_multi_abi_forward_vars
|
||||
BUILD_OPTIONS
|
||||
${multi_abi_vars}
|
||||
"-DQT_ANDROID_MULTI_ABI_FORWARD_VARS=${multi_abi_forward_vars}"
|
||||
"-DTEST_SINGLE_VALUE_ARG=${single_value}"
|
||||
"-DTEST_LIST_VALUE_ARG=${list_value}"
|
||||
"-DTEST_ESCAPING_VALUE_ARG=${escaping_value}"
|
||||
"-DTEST_SPACES_VALUE_ARG=${spaces_value}"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT NO_WIDGETS)
|
||||
_qt_internal_test_expect_pass(test_build_simple_widget_app)
|
||||
set(extra_widget_app_options "")
|
||||
|
@ -0,0 +1,33 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(test_android_multi_abi_forward_vars)
|
||||
|
||||
find_package(Qt6 COMPONENTS Core Gui REQUIRED)
|
||||
|
||||
if(NOT TEST_SINGLE_VALUE_ARG STREQUAL "TestValue")
|
||||
message(FATAL_ERROR
|
||||
"TEST_SINGLE_VALUE_ARG is not valid: ${TEST_SINGLE_VALUE_ARG}")
|
||||
endif()
|
||||
|
||||
if(NOT TEST_LIST_VALUE_ARG STREQUAL "TestValue;TestValue2;TestValue3")
|
||||
message(FATAL_ERROR
|
||||
"TEST_LIST_VALUE_ARG is not valid: ${TEST_LIST_VALUE_ARG}")
|
||||
endif()
|
||||
|
||||
if(NOT TEST_ESCAPING_VALUE_ARG STREQUAL "TestValue\;TestValue2\;TestValue3")
|
||||
message(FATAL_ERROR
|
||||
"TEST_ESCAPING_VALUE_ARG is not valid: ${TEST_ESCAPING_VALUE_ARG}")
|
||||
endif()
|
||||
|
||||
if(NOT TEST_SPACES_VALUE_ARG STREQUAL "TestValue TestValue2 TestValue3")
|
||||
message(FATAL_ERROR
|
||||
"TEST_SPACES_VALUE_ARG is not valid: ${TEST_SPACES_VALUE_ARG}")
|
||||
endif()
|
||||
|
||||
# Make sure that ABI external projects are created
|
||||
qt6_add_executable(test_executable main.cpp)
|
||||
|
||||
target_link_libraries(test_executable PRIVATE Qt::Core Qt::Gui)
|
@ -0,0 +1,4 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
int main(int, char *[]) { return 0; }
|
Loading…
Reference in New Issue
Block a user