Fix host architecture detection for canadian cross builds

If the host architecture is different from -platform (canadian cross
build with -external-hostbindir) then we cannot use QMAKE_HOST.os to
deduce the executable extension for that platform, because this value
comes from the qmake binary that was pointed to by
-external-hostbindir.

Move the target name deduction mechanism to the actual configure test
.pro files to make sure the right scopes are available, and write the
deduced target name to a text file. That text file is read by
qtConfTest_architecture to get the right binary to analyze.

Fixes: QTBUG-77286
Change-Id: I68b844dd51dbfda6432a4b0dca6331899c82255f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Joerg Bornemann 2019-08-02 09:24:37 +02:00
parent aef0fba3c5
commit 39e937a538
4 changed files with 17 additions and 19 deletions

View File

@ -1 +1,2 @@
SOURCES = arch.cpp
include(write_info.pri)

View File

@ -1,2 +1,3 @@
option(host_build)
SOURCES = arch.cpp
include(write_info.pri)

View File

@ -0,0 +1,14 @@
targetinfofile = $$basename(_PRO_FILE_)
targetinfofile ~= s/pro$/target.txt/
win32 {
ext = .exe
} else:android {
file_prefix = lib
ext = .so
} else:wasm {
ext = .wasm
}
content = $${file_prefix}$${TARGET}$${ext}
write_file($$OUT_PWD/$$targetinfofile, content)

View File

@ -266,28 +266,10 @@ defineTest(qtConfTest_architecture) {
!qtConfTest_compile($${1}): \
error("Could not determine $$eval($${1}.label). See config.log for details.")
host = $$eval($${1}.host)
isEmpty(host): host = false
file_prefix =
ext =
$$host {
equals(QMAKE_HOST.os, Windows): \
ext = .exe
} else {
win32 {
ext = .exe
} else:android {
file_prefix = lib
ext = .so
} else:wasm {
ext = .wasm
}
}
test = $$eval($${1}.test)
output = $$eval($${1}.output)
test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test
test_out_file = $$test_out_dir/$$file_prefix$$output$$ext
test_out_file = $$test_out_dir/$$cat($$test_out_dir/$${output}.target.txt)
exists($$test_out_file): \
content = $$cat($$test_out_file, blob)
else: \