wasm: handle cmake's RUNTIME_OUTPUT_DIRECTORY

Also OUTPUT_NAME

Pick-to: 6.4
Fixes: QTBUG-105923
Change-Id: Iaef92b068845d69fad4f73abb7e15dcba3107265
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
bb10
Lorn Potter 2022-08-30 17:37:31 +10:00
parent 76abdaafb5
commit 0f80b65a01
1 changed files with 30 additions and 16 deletions

View File

@ -8,32 +8,46 @@ 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()
_qt_internal_test_batch_target_name(test_batch_target_name)
if(QT_BUILD_TESTS_BATCHED AND target STREQUAL test_batch_target_name)
get_target_property(batch_output_dir ${target} RUNTIME_OUTPUT_DIRECTORY)
configure_file("${WASM_BUILD_DIR}/libexec/batchedtestrunner.html"
"${batch_output_dir}/batchedtestrunner.html" COPYONLY)
configure_file("${WASM_BUILD_DIR}/libexec/batchedtestrunner.js"
"${batch_output_dir}/batchedtestrunner.js" COPYONLY)
configure_file("${WASM_BUILD_DIR}/libexec/qwasmjsruntime.js"
"${batch_output_dir}/qwasmjsruntime.js" COPYONLY)
configure_file("${WASM_BUILD_DIR}/libexec/util.js"
"${batch_output_dir}/util.js" 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}.html")
"${_target_directory}/${_target_output_name}.html")
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtloader.js"
qtloader.js COPYONLY)
${_target_directory}/qtloader.js COPYONLY)
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg"
qtlogo.svg COPYONLY)
${_target_directory}/qtlogo.svg COPYONLY)
endif()
if(QT_FEATURE_thread)