GODT-1569: upgrade bridge from qt 5 to qt 6.

Fixed issues introduced by upgrading to Qt 5.15.
WIP: upgrade to Qt 6
WIP: QML fixes. [sklp-ci]
WIP: macOS font fix.
WIP: backend is a now a singleton.
WIP: remove version number of import.
WIP: fixed missing Action in qmldir.
WIP: fixed errors on program exit.
WIP: CMake detects host arch on mac if not specified.
This commit is contained in:
Xavier Michelon
2022-07-14 18:08:54 +02:00
committed by Jakub
parent 8f2e616e07
commit 664f81249c
65 changed files with 742 additions and 714 deletions

View File

@ -17,15 +17,30 @@
cmake_minimum_required(VERSION 3.22)
set(CMAKE_OSX_ARCHITECTURES x86_64) # needs to be set before the first project() directive.
#We rely on vcpkg for to get gRPC+Protobuf
if (NOT DEFINED ENV{VCPKG_ROOT})
message(FATAL_ERROR "vcpkg is required. Install vcpkg and define VCPKG_ROOT to point the the vcpkg installation folder. (e.g. ~/vcpkg/")
endif()
# For now we support only a single architecture for macOS (ARM64 or x86_64). We need to investigate how to build universal binaries with vcpkg.
if (APPLE)
set(VCPKG_TARGET_TRIPLET x64-osx)
if (NOT DEFINED CMAKE_OSX_ARCHITECTURES)
execute_process(COMMAND "uname" "-m" OUTPUT_VARIABLE UNAME_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_OSX_ARCHITECTURES ${UNAME_RESULT} CACHE STRING "osx_architectures")
endif()
if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
message(STATUS "Building for Apple Silicon Mac computers")
set(VCPKG_TARGET_TRIPLET arm64-osx)
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
message(STATUS "Building for Intel based Mac computers")
set(VCPKG_TARGET_TRIPLET x64-osx)
else ()
message(FATAL_ERROR "Unknown value for CMAKE_OSX_ARCHITECTURE. Please use one of \"arm64\" and \"x86_64\". Multiple architectures are not supported.")
endif ()
endif()
if (WIN32)
set(VCPKG_TARGET_TRIPLET x64-mingw-static)
endif()
@ -33,16 +48,15 @@ set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CAC
project(bridge-gui LANGUAGES CXX)
if (APPLE) # On macOS, we have some Objective-C++ code in DockIcon to deal with ... the dock icon.
if (APPLE) # On macOS, we have some Objective-C++ code in DockIcon to deal with the dock icon.
enable_language(OBJC OBJCXX)
endif()
if (NOT DEFINED ENV{QT5DIR})
message(FATAL_ERROR "QT5DIR needs to be defined and point to the root of your Qt5 folder (e.g. /Users/MyName/Qt/5.10.1/clang_64).")
if (NOT DEFINED ENV{QT6DIR})
message(FATAL_ERROR "QT6DIR needs to be defined and point to the root of your Qt 6 folder (e.g. /Users/MyName/Qt/6.3.1/clang_64).")
endif()
set(CMAKE_PREFIX_PATH $ENV{QT5DIR} ${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH $ENV{QT6DIR} ${CMAKE_PREFIX_PATH})
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
@ -61,7 +75,7 @@ if (APPLE) # We need to link the Cocoa framework for the dock icon.
endif()
find_package(Qt5 COMPONENTS
find_package(Qt6 COMPONENTS
Core
Quick
Qml
@ -136,10 +150,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
target_precompile_headers(bridge-gui PRIVATE Pch.h)
target_link_libraries(bridge-gui
Qt5::Core
Qt5::Quick
Qt5::Qml
Qt5::QuickControls2
Qt6::Core
Qt6::Quick
Qt6::Qml
Qt6::QuickControls2
protobuf::libprotobuf
gRPC::grpc++
)