diff --git a/src/corelib/Qt6WasmMacros.cmake b/src/corelib/Qt6WasmMacros.cmake index b95ab6f80f3..b6de1bd2d4c 100644 --- a/src/corelib/Qt6WasmMacros.cmake +++ b/src/corelib/Qt6WasmMacros.cmake @@ -5,20 +5,47 @@ function(_qt_internal_wasm_add_target_helpers target) get_target_property(targetType "${target}" TYPE) if("${targetType}" STREQUAL "EXECUTABLE") - set(APPNAME ${target}) - if(QT6_INSTALL_PREFIX) set(WASM_BUILD_DIR "${QT6_INSTALL_PREFIX}") elseif(QT_BUILD_DIR) set(WASM_BUILD_DIR "${QT_BUILD_DIR}") endif() - configure_file("${WASM_BUILD_DIR}/plugins/platforms/wasm_shell.html" - "${target}.html") - configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtloader.js" - qtloader.js COPYONLY) - configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg" - qtlogo.svg COPYONLY) + get_target_property(output_name ${target} OUTPUT_NAME) + if(NOT "${output_name}" STREQUAL "") + set(_target_output_name "${output_name}") + else() + set(_target_output_name "${target}") + endif() + + set(APPNAME ${_target_output_name}) + + _qt_internal_test_batch_target_name(test_batch_target_name) + get_target_property(target_output_directory ${target} RUNTIME_OUTPUT_DIRECTORY) + + if(QT_BUILD_TESTS_BATCHED AND target STREQUAL test_batch_target_name) + configure_file("${WASM_BUILD_DIR}/libexec/batchedtestrunner.html" + "${target_output_directory}/batchedtestrunner.html" COPYONLY) + configure_file("${WASM_BUILD_DIR}/libexec/batchedtestrunner.js" + "${target_output_directory}/batchedtestrunner.js" COPYONLY) + configure_file("${WASM_BUILD_DIR}/libexec/qwasmjsruntime.js" + "${target_output_directory}/qwasmjsruntime.js" COPYONLY) + configure_file("${WASM_BUILD_DIR}/libexec/util.js" + "${target_output_directory}/util.js" COPYONLY) + else() + if(NOT "${target_output_directory}" STREQUAL "") + set(_target_directory "${target_output_directory}") + else() + set(_target_directory "${CMAKE_CURRENT_BINARY_DIR}") + endif() + + configure_file("${WASM_BUILD_DIR}/plugins/platforms/wasm_shell.html" + "${_target_directory}/${_target_output_name}.html") + configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtloader.js" + ${_target_directory}/qtloader.js COPYONLY) + configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg" + ${_target_directory}/qtlogo.svg COPYONLY) + endif() if(QT_FEATURE_thread) set(POOL_SIZE 4)