wasm: handle cmake's RUNTIME_OUTPUT_DIRECTORY

Also OUTPUT_NAME

Fixes: QTBUG-105923
Change-Id: Iaef92b068845d69fad4f73abb7e15dcba3107265
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Lorn Potter 2022-08-30 17:37:31 +10:00
parent d7620f1b74
commit 06b95cf55e

View File

@ -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)