summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2023-04-06 11:54:55 +0200
committerMichal Klocek <michal.klocek@qt.io>2023-08-29 18:37:23 +0200
commit2e62b359cbe3877844c3cb0f8dabdd1426809fd9 (patch)
tree93cb0d8fb33a494db43add95a4b824b9fcd9c048
parent014ac76db7278d1bb224322ab8c74e3a2b67c087 (diff)
Migrate hostcompiler test to cmake host project
Check for 32-bit support in case of 64bit compiler and cross-compilation. This is required as v8 context generator needs same bit width as target one. Change-Id: I921e9e657c9caa97d3c6b63f7c1c87ab1052c92f Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io> (cherry picked from commit b698955b933e20ef3cf83ed6c7bb8bbd7cce3aca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--config.tests/hostcompiler/hostcompiler.pro9
-rw-r--r--src/host/CMakeLists.txt14
-rw-r--r--src/host/config.tests/hostcompiler/CMakeLists.txt11
-rw-r--r--src/host/config.tests/hostcompiler/main.cpp (renamed from config.tests/hostcompiler/main.cpp)0
4 files changed, 25 insertions, 9 deletions
diff --git a/config.tests/hostcompiler/hostcompiler.pro b/config.tests/hostcompiler/hostcompiler.pro
deleted file mode 100644
index 5a80246ab..000000000
--- a/config.tests/hostcompiler/hostcompiler.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-option(host_build)
-
-gcc:equals(QT_ARCH, "x86_64"):contains(QT_TARGET_ARCH, "arm"):!contains(QT_TARGET_ARCH, "arm64") {
- QMAKE_CXXFLAGS += -m32
- QMAKE_LFLAGS += -m32
-}
-
-SOURCES = main.cpp
-
diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt
index 0b4238821..6d327a330 100644
--- a/src/host/CMakeLists.txt
+++ b/src/host/CMakeLists.txt
@@ -52,3 +52,17 @@ if(QT_FEATURE_qtpdf_build)
)
endif()
+# TODO: this could be run as part of main configure with execute_process
+
+if(CMAKE_CXX_COMPILER_ID STREQUAL GNU AND TEST_architecture_arch STREQUAL "x86_64"
+AND GN_TARGET_CPU STREQUAL "arm")
+ try_compile(
+ has32HostCompiler
+ "${CMAKE_CURRENT_BINARY_DIR}/config.tests/hostcompiler"
+ "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/hostcompiler"
+ hostcompiler
+ )
+ if(NOT has32HostCompiler)
+ MESSAGE(FATAL_ERROR "Compiler does not support 32bit compilation")
+ endif()
+endif()
diff --git a/src/host/config.tests/hostcompiler/CMakeLists.txt b/src/host/config.tests/hostcompiler/CMakeLists.txt
new file mode 100644
index 000000000..f36886d0a
--- /dev/null
+++ b/src/host/config.tests/hostcompiler/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(arch LANGUAGES CXX)
+
+add_executable(host_compiler_test)
+set_property(TARGET host_compiler_test PROPERTY MACOSX_BUNDLE FALSE)
+target_sources(host_compiler_test PRIVATE main.cpp)
+target_compile_options(host_compiler_test PRIVATE -m32)
+target_link_options(host_compiler_test PRIVATE -m32)
diff --git a/config.tests/hostcompiler/main.cpp b/src/host/config.tests/hostcompiler/main.cpp
index 1676f7a26..1676f7a26 100644
--- a/config.tests/hostcompiler/main.cpp
+++ b/src/host/config.tests/hostcompiler/main.cpp