wasm: Stop configuration if Emscripten versions don't match

Emscripten compiler toolchain does not guarantee ABI stability.
Hence, it does not make sense to build Qt with one version of compiler,
and then build the Qt application with other one.
Treat it as an error if there is mismatch between Emscripten version
used for building Qt and version used for building application.

Change-Id: Ia720da25ecbd048a009d0bf1927ba1bc1fa85fda
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Ivan Tkachenko <me@ratijas.tk>
This commit is contained in:
Piotr Wierciński 2024-11-20 10:31:22 +01:00
parent 2f8f274cae
commit 9fab958148
2 changed files with 7 additions and 5 deletions

View File

@ -98,9 +98,11 @@ function(_qt_test_emscripten_version)
__qt_internal_get_qt_build_emsdk_version(qt_build_emcc_version)
if(NOT "${qt_build_emcc_version}" STREQUAL "" AND NOT "${qt_build_emcc_version}" STREQUAL "${current_emsdk_ver}")
message("Qt Wasm built with Emscripten version: ${qt_build_emcc_version}")
message("You are using Emscripten version: ${current_emsdk_ver}")
message("The recommended version of Emscripten for this Qt is: ${_recommended_emver}")
message("This may not work correctly")
message(FATAL_ERROR
"Qt Wasm was built with Emscripten version: ${qt_build_emcc_version}\n"
"You are using Emscripten version: ${current_emsdk_ver}\n"
"The recommended version of Emscripten for this Qt is: ${_recommended_emver}\n"
"Stopping configuration due to mismatch of Emscripten versions."
)
endif()
endfunction()

View File

@ -19,7 +19,7 @@ defineTest(qtConfTest_emccVersion) {
}
contains(TEMPLATE, .*app) {
!equals(QT_EMCC_VERSION, $$EMCC_VERSION) {
warning("This Qt was built with Emscripten version $${QT_EMCC_VERSION}. You have $${EMCC_VERSION}. The difference may cause issues.")
error("This Qt was built with Emscripten version $${QT_EMCC_VERSION}. You have $${EMCC_VERSION}. Stopping configuration due to mismatch of Emscripten versions.")
}
}
}