diff options
Diffstat (limited to 'src/host')
-rw-r--r-- | src/host/BUILD.toolchain.gn.in | 18 | ||||
-rw-r--r-- | src/host/CMakeLists.txt | 68 | ||||
-rw-r--r-- | src/host/config.tests/hostcompiler/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/host/config.tests/hostcompiler/main.cpp | 9 |
4 files changed, 106 insertions, 0 deletions
diff --git a/src/host/BUILD.toolchain.gn.in b/src/host/BUILD.toolchain.gn.in new file mode 100644 index 000000000..1beb9ee6d --- /dev/null +++ b/src/host/BUILD.toolchain.gn.in @@ -0,0 +1,18 @@ +import("//build/config/sysroot.gni") +import("//build/toolchain/gcc_toolchain.gni") +gcc_toolchain("@GN_TOOLCHAIN@") { + cc = "@CMAKE_C_COMPILER@" + cxx = "@CMAKE_CXX_COMPILER@" + ld = "@CMAKE_CXX_COMPILER@" + ar = "@CMAKE_AR@" + nm = "@CMAKE_NM@" + extra_cppflags = "" + toolchain_args = { + current_os = "@GN_OS@" + current_cpu = "@GN_CPU@" + v8_current_cpu = "@GN_V8_CPU@" + is_clang = @GN_IS_CLANG@ + is_mingw = @GN_IS_MINGW@ + use_gold = false + } +} diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt new file mode 100644 index 000000000..d40275217 --- /dev/null +++ b/src/host/CMakeLists.txt @@ -0,0 +1,68 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.19) + +if(NOT DEFINED WEBENGINE_ROOT_SOURCE_DIR) + get_filename_component(WEBENGINE_ROOT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." REALPATH) +endif() +if (NOT DEFINED WEBENGINE_ROOT_BUILD_DIR) + get_filename_component(WEBENGINE_ROOT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/../.." REALPATH) +endif() + +include(${WEBENGINE_ROOT_SOURCE_DIR}/.cmake.conf) +include(${WEBENGINE_ROOT_SOURCE_DIR}/cmake/Functions.cmake) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBENGINE_ROOT_SOURCE_DIR}/cmake") + +project(QtWebEngineConfigure + VERSION "${QT_REPO_MODULE_VERSION}" + LANGUAGES CXX C) + +find_package(Qt6 6.5 CONFIG REQUIRED COMPONENTS BuildInternals Core) +qt_internal_project_setup() +get_gn_arch(target_arch ${GN_TARGET_CPU}) +get_gn_arch(host_arch ${TEST_architecture_arch}) +get_v8_arch(v8_arch ${target_arch} ${host_arch}) + +set(buildDir ${CMAKE_CURRENT_BINARY_DIR}) +configure_gn_toolchain(host ${host_arch} ${host_arch} + ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/BUILD.toolchain.gn.in + ${buildDir}/host_toolchain +) +configure_gn_toolchain(v8 ${v8_arch} ${target_arch} + ${WEBENGINE_ROOT_SOURCE_DIR}/src/host/BUILD.toolchain.gn.in + ${buildDir}/v8_toolchain) + +if(QT_FEATURE_qtwebengine_build) + install(FILES ${buildDir}/host_toolchain/BUILD.gn + DESTINATION ${WEBENGINE_ROOT_BUILD_DIR}/src/core/host_toolchain + ) + install(FILES ${buildDir}/v8_toolchain/BUILD.gn + DESTINATION ${WEBENGINE_ROOT_BUILD_DIR}/src/core/v8_toolchain + ) +endif() +if(QT_FEATURE_qtpdf_build) + install(FILES ${buildDir}/host_toolchain/BUILD.gn + DESTINATION ${WEBENGINE_ROOT_BUILD_DIR}/src/pdf/host_toolchain + ) + install(FILES ${buildDir}/v8_toolchain/BUILD.gn + DESTINATION ${WEBENGINE_ROOT_BUILD_DIR}/src/pdf/v8_toolchain + ) +endif() + +# TODO: this could be run as part of main configure with execute_process +# Skip for qtpdf(android) + +if(CMAKE_CXX_COMPILER_ID STREQUAL GNU AND TEST_architecture_arch STREQUAL "x86_64" + AND GN_TARGET_CPU STREQUAL "arm" AND NOT MINGW AND NOT ANDROID) + 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/src/host/config.tests/hostcompiler/main.cpp b/src/host/config.tests/hostcompiler/main.cpp new file mode 100644 index 000000000..9cd16a2e3 --- /dev/null +++ b/src/host/config.tests/hostcompiler/main.cpp @@ -0,0 +1,9 @@ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: BSD-3-Clause + +#include <stdio.h> +int main() +{ + printf("This works\n"); + return 0; +} |