diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index f2418303c6e..80eceab27ae 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1260,10 +1260,29 @@ function(qt_generate_global_device_pri_file) string(APPEND content "${opt}\n") endforeach() - if(TEST_machine_tuple) - string(APPEND content "GCC_MACHINE_DUMP = ${TEST_machine_tuple}\n") + # Write android specific device info. + if(ANDROID) + string(APPEND content "DEFAULT_ANDROID_SDK_ROOT = ${ANDROID_SDK_ROOT}\n") + string(APPEND content "DEFAULT_ANDROID_NDK_ROOT = ${ANDROID_NDK}\n") + + set(android_platform "android-23") + if(ANDROID_NATIVE_API_LEVEL) + set(android_platform "android-${ANDROID_NATIVE_API_LEVEL}") + endif() + string(APPEND content "DEFAULT_ANDROID_PLATFORM = ${android_platform}\n") + + string(APPEND content "DEFAULT_ANDROID_NDK_HOST = ${ANDROID_HOST_TAG}\n") + + # TODO: QTBUG-80943 When we eventually support Android multi-abi, this should be changed. + string(APPEND content "DEFAULT_ANDROID_ABIS = ${ANDROID_ABI}\n") endif() + set(gcc_machine_dump "") + if(TEST_machine_tuple) + set(gcc_machine_dump "${TEST_machine_tuple}") + endif() + string(APPEND content "GCC_MACHINE_DUMP = ${gcc_machine_dump}\n") + file(GENERATE OUTPUT "${qdevice_pri_target_path}" CONTENT "${content}") qt_install(FILES "${qdevice_pri_target_path}" DESTINATION ${INSTALL_MKSPECSDIR}) endfunction() @@ -1430,12 +1449,20 @@ Prefix=${ext_prefix_relative_to_conf_file} ") endif() + # On Android CMAKE_SYSROOT is set, but for Qt's purposes it should not be set, because then + # qmake generates incorrect Qt module include flags (among other things). Do the same for darwin + # cross-compilation. + set(sysroot "") + if(CMAKE_SYSROOT AND NOT ANDROID AND NOT UIKIT) + set(sysroot "${CMAKE_SYSROOT}") + endif() + string(APPEND content "[Paths] Prefix=${ext_prefix_relative_to_conf_file} HostPrefix=${host_prefix_relative_to_conf_file} HostData=${ext_prefix_relative_to_host_prefix} -Sysroot=${CMAKE_SYSROOT} +Sysroot=${sysroot} SysrootifyPrefix=${sysrootify_prefix} TargetSpec=${QT_QMAKE_TARGET_MKSPEC} HostSpec=${QT_QMAKE_HOST_MKSPEC} diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index 870ae0d1945..1ac23200c8f 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -858,7 +858,7 @@ function(qt_config_compile_test_x86simd extension label) endfunction() function(qt_config_compile_test_machine_tuple label) - if(DEFINED TEST_MACHINE_TUPLE OR NOT (GCC OR CLANG)) + if(DEFINED TEST_MACHINE_TUPLE OR NOT LINUX OR ANDROID) return() endif()