CMake: Add Android build information to generated module .json files

Qt Creator maintains a mapping from Qt version to Android NDK version
and other build information. It's simpler to let the Qt build write the
Android build information into modules/Core.json and have Qt Creator use
this information.

This adds the following properties to the module JSON files:
  - built_with.android.api_version
  - built_with.android.ndk.version

Task-number: QTBUG-108292
Change-Id: I0febda5192289c5afb1a098880b31bef6317db35
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2022-12-06 16:12:12 +01:00
parent 8bffcdc52f
commit 1180d5b8a2
2 changed files with 11 additions and 1 deletions

View File

@ -1,7 +1,7 @@
{
"module_name": "${target}",
"version": "${PROJECT_VERSION}",
"built_with": {
"built_with": {${extra_build_information}
"compiler_id": "${CMAKE_CXX_COMPILER_ID}",
"compiler_target": "${CMAKE_CXX_COMPILER_TARGET}",
"compiler_version": "${CMAKE_CXX_COMPILER_VERSION}",

View File

@ -1021,6 +1021,16 @@ function(qt_describe_module target)
if(CMAKE_CROSSCOMPILING)
set(cross_compilation "true")
endif()
set(extra_build_information "")
if(ANDROID)
string(APPEND extra_build_information "
\"android\": {
\"api_version\": \"${QT_ANDROID_API_VERSION}\",
\"ndk\": {
\"version\": \"${ANDROID_NDK_REVISION}\"
}
},")
endif()
configure_file("${descfile_in}" "${descfile_out}")
qt_install(FILES "${descfile_out}" DESTINATION "${install_dir}")