Other: move frontend C++ code ini a subfolder.

This commit is contained in:
Xavier Michelon
2022-08-04 16:51:42 +02:00
committed by Jakub
parent 22a8aab151
commit a8788feb50
161 changed files with 145 additions and 121 deletions

View File

@ -1,34 +0,0 @@
# Copyright (c) 2022 Proton AG
#
# This file is part of Proton Mail Bridge.
#
# Proton Mail Bridge is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Proton Mail Bridge is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.22)
#*****************************************************************************************************************************************************
# Project
#*****************************************************************************************************************************************************
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../extern/vcpkg")
include("bridge_setup.cmake")
project(frontend)
add_subdirectory(bridgepp)
add_subdirectory(bridge-gui)

View File

@ -17,8 +17,6 @@
cmake_minimum_required(VERSION 3.22)
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../extern/vcpkg")
include(../bridge_setup.cmake)
#*****************************************************************************************************************************************************
@ -26,83 +24,11 @@ include(../bridge_setup.cmake)
#*****************************************************************************************************************************************************
project(bridge-gui LANGUAGES CXX)
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../extern/vcpkg")
include("BridgeSetup.cmake")
if (NOT DEFINED BRIDGE_APP_VERSION)
message(FATAL_ERROR "BRIDGE_APP_VERSION is not defined.")
else()
message(STATUS "Bridge version is ${BRIDGE_APP_VERSION}")
endif()
project(frontend)
configure_file(Version.h.in ${CMAKE_SOURCE_DIR}/Version.h)
if (APPLE) # On macOS, we have some Objective-C++ code in DockIcon to deal with the dock icon.
enable_language(OBJC OBJCXX)
endif()
add_subdirectory(bridgepp)
add_subdirectory(bridge-gui)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (APPLE) # We need to link the Cocoa framework for the dock icon.
find_library(COCOA_LIBRARY Cocoa REQUIRED)
endif()
#*****************************************************************************************************************************************************
# Qt
#*****************************************************************************************************************************************************
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{QT6DIR} ${CMAKE_PREFIX_PATH})
find_package(Qt6 COMPONENTS Core Quick Qml QuickControls2 REQUIRED)
qt_standard_project_setup()
set(CMAKE_AUTORCC ON)
message(STATUS "Using Qt ${Qt6_VERSION}")
#*****************************************************************************************************************************************************
# Source files and output
#*****************************************************************************************************************************************************
configure_file(Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
if (NOT TARGET bridgepp)
add_subdirectory(../bridgepp bridgepp)
endif()
if (APPLE)
set(DOCK_ICON_SRC_FILE DockIcon/DockIcon.mm)
else()
set(DOCK_ICON_SRC_FILE DockIcon/DockIcon.cpp)
endif()
add_executable(bridge-gui
Resources.qrc
AppController.cpp AppController.h
BridgeMonitor.cpp BridgeMonitor.h
EventStreamWorker.cpp EventStreamWorker.h
main.cpp
Pch.h
Version.h
QMLBackend.cpp QMLBackend.h
UserList.cpp UserList.h
${DOCK_ICON_SRC_FILE} DockIcon/DockIcon.h
UserDirectories.h)
target_precompile_headers(bridge-gui PRIVATE Pch.h)
target_include_directories(bridge-gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(bridge-gui
Qt6::Core
Qt6::Quick
Qt6::Qml
Qt6::QuickControls2
bridgepp
)
if (APPLE)
target_link_libraries(bridge-gui ${COCOA_LIBRARY})
endif()

View File

@ -0,0 +1,108 @@
# Copyright (c) 2022 Proton AG
#
# This file is part of Proton Mail Bridge.
#
# Proton Mail Bridge is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Proton Mail Bridge is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.22)
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../extern/vcpkg")
include(../BridgeSetup.cmake)
#*****************************************************************************************************************************************************
# Project
#*****************************************************************************************************************************************************
project(bridge-gui LANGUAGES CXX)
if (NOT DEFINED BRIDGE_APP_VERSION)
message(FATAL_ERROR "BRIDGE_APP_VERSION is not defined.")
else()
message(STATUS "Bridge version is ${BRIDGE_APP_VERSION}")
endif()
configure_file(Version.h.in ${CMAKE_SOURCE_DIR}/Version.h)
if (APPLE) # On macOS, we have some Objective-C++ code in DockIcon to deal with the dock icon.
enable_language(OBJC OBJCXX)
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (APPLE) # We need to link the Cocoa framework for the dock icon.
find_library(COCOA_LIBRARY Cocoa REQUIRED)
endif()
#*****************************************************************************************************************************************************
# Qt
#*****************************************************************************************************************************************************
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{QT6DIR} ${CMAKE_PREFIX_PATH})
find_package(Qt6 COMPONENTS Core Quick Qml QuickControls2 REQUIRED)
qt_standard_project_setup()
set(CMAKE_AUTORCC ON)
message(STATUS "Using Qt ${Qt6_VERSION}")
#*****************************************************************************************************************************************************
# Source files and output
#*****************************************************************************************************************************************************
configure_file(Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
if (NOT TARGET bridgepp)
add_subdirectory(../bridgepp bridgepp)
endif()
if (APPLE)
set(DOCK_ICON_SRC_FILE DockIcon/DockIcon.mm)
else()
set(DOCK_ICON_SRC_FILE DockIcon/DockIcon.cpp)
endif()
add_executable(bridge-gui
Resources.qrc
AppController.cpp AppController.h
BridgeMonitor.cpp BridgeMonitor.h
EventStreamWorker.cpp EventStreamWorker.h
main.cpp
Pch.h
Version.h
QMLBackend.cpp QMLBackend.h
UserList.cpp UserList.h
${DOCK_ICON_SRC_FILE} DockIcon/DockIcon.h
UserDirectories.h)
target_precompile_headers(bridge-gui PRIVATE Pch.h)
target_include_directories(bridge-gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(bridge-gui
Qt6::Core
Qt6::Quick
Qt6::Qml
Qt6::QuickControls2
bridgepp
)
if (APPLE)
target_link_libraries(bridge-gui ${COCOA_LIBRARY})
endif()

View File

@ -0,0 +1,24 @@
// Copyright (c) 2022 Proton AG
//
// This file is part of Proton Mail Bridge.
//
// Proton Mail Bridge is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Proton Mail Bridge is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
#ifndef BRIDGE_GUI_VERSION_H
#define BRIDGE_GUI_VERSION_H
#define PROJECT_VER "2.2.1+git"
#endif // BRIDGE_GUI_VERSION_H

View File

@ -23,7 +23,7 @@ $cmakeExe = "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE
$bridgeVersion = ($env:BRIDGE_APP_VERSION ??= "2.2.1+") # TODO get the version number from a unified location.
$buildConfig = ($env:BRIDGE_GUI_BUILD_CONFIG ??= "Debug")
$buildDir=(Join-Path $PSScriptRoot "cmake-build-$buildConfig-visual-studio".ToLower())
$vcpkgRoot = (Join-Path $PSScriptRoot "../../../extern/vcpkg" -Resolve)
$vcpkgRoot = (Join-Path $PSScriptRoot "../../../../extern/vcpkg" -Resolve)
$vcpkgExe = (Join-Path $vcpkgRoot "vcpkg.exe")
$vcpkgBootstrap = (Join-Path $vcpkgRoot "bootstrap-vcpkg.bat")

View File

@ -20,7 +20,7 @@
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-2.2.1+git} # TODO get the version number from a unified location.
BUILD_CONFIG=${BRIDGE_GUI_BUILD_CONFIG:-Debug}
BUILD_DIR=$(echo "./cmake-build-${BUILD_CONFIG}" | tr '[:upper:]' '[:lower:]')
VCPKG_ROOT="../../../extern/vcpkg"
VCPKG_ROOT="../../../../extern/vcpkg"
VCPKG_EXE="${VCPKG_ROOT}/vcpkg"
VCPKG_BOOTSTRAP="${VCPKG_ROOT}/bootstrap-vcpkg.sh"
@ -61,4 +61,4 @@ cmake -DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" -DBRIDGE_APP_VERSION="${BRIDGE_APP_V
check_exit "CMake failed"
cmake --build "${BUILD_DIR}"
check_exit "build failed"
check_exit "build failed"

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1013 B

After

Width:  |  Height:  |  Size: 1013 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 304 B

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

View File

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 283 B

View File

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 284 B

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View File

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View File

Before

Width:  |  Height:  |  Size: 396 B

After

Width:  |  Height:  |  Size: 396 B

View File

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 327 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More