From 97420aaa463843b01689db09ccbf5192dc1d12b6 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 12 Nov 2024 14:03:05 +0100 Subject: [PATCH] Android: Do not duplicate copy_if_different command for android target The CMake copy_if_different command, which copies the android target library to a libs/ directory could be executed in different code paths which caused a multiple access to a same file in a filesystem. Avoid doing this and depend on _prepare_apk_dir target for the depfile code path too. Pick-to: 6.5 Change-Id: Ib62cf24ecc69a17ce1b52cd1f001aeff866051cd Reviewed-by: Assam Boudjelthia Reviewed-by: Alexandru Croitor (cherry picked from commit 76fef03f19ab2a41ec9fdc9a72a08b5e1ea80a95) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/Qt6AndroidMacros.cmake | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index b185e0ba0e6..7686a568890 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -524,9 +524,6 @@ function(qt6_android_add_apk_target target) # Add custom command that creates the apk and triggers rebuild if files listed in # ${dep_file_path} are changed. add_custom_command(OUTPUT "${apk_final_file_path}" - COMMAND ${CMAKE_COMMAND} - -E copy "$" - "${apk_final_dir}/${target_file_copy_relative_path}" COMMAND "${deployment_tool}" --input "${deployment_file}" --output "${apk_final_dir}" @@ -536,7 +533,7 @@ function(qt6_android_add_apk_target target) ${extra_args} ${sign_apk} COMMENT "Creating APK for ${target}" - DEPENDS "${target}" "${deployment_file}" ${extra_deps} + DEPENDS "${target}" "${deployment_file}" ${extra_deps} ${target}_prepare_apk_dir DEPFILE "${dep_file_path}" VERBATIM ${uses_terminal} @@ -545,9 +542,6 @@ function(qt6_android_add_apk_target target) # Add custom command that creates the aar and triggers rebuild if files listed in # ${dep_file_path} are changed. add_custom_command(OUTPUT "${aar_final_file_path}" - COMMAND ${CMAKE_COMMAND} - -E copy "$" - "${apk_final_dir}/${target_file_copy_relative_path}" COMMAND "${deployment_tool}" --input "${deployment_file}" --output "${apk_final_dir}" @@ -557,7 +551,7 @@ function(qt6_android_add_apk_target target) --build-aar ${extra_args} COMMENT "Creating AAR for ${target}" - DEPENDS "${target}" "${deployment_file}" ${extra_deps} + DEPENDS "${target}" "${deployment_file}" ${extra_deps} ${target}_prepare_apk_dir DEPFILE "${dep_file_path}" VERBATIM ${uses_terminal}