Other: added vcpkg as a submodule + build scripts
This commit is contained in:
parent
033139677b
commit
fd8abc168d
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "submodules/vcpkg"]
|
||||||
|
path = extern/vcpkg
|
||||||
|
url = https://github.com/Microsoft/vcpkg.git
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit f93ba152d55e1d243160e690bc302ffe8638358e
|
|
@ -17,9 +17,15 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.22)
|
cmake_minimum_required(VERSION 3.22)
|
||||||
|
|
||||||
#We rely on vcpkg for to get gRPC+Protobuf
|
# We rely on vcpkg for to get gRPC / Protobuf
|
||||||
if (NOT DEFINED ENV{VCPKG_ROOT})
|
# run build.sh / build.ps1 to get gRPC / Protobuf and dependencies installed.
|
||||||
message(FATAL_ERROR "vcpkg is required. Install vcpkg and define VCPKG_ROOT to point the the vcpkg installation folder. (e.g. ~/vcpkg/")
|
|
||||||
|
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../extern/vcpkg")
|
||||||
|
message(STATUS "VCPKG_ROOT is ${VCPKG_ROOT}")
|
||||||
|
if (WIN32)
|
||||||
|
find_program(VCPKG_EXE "${VCPKG_ROOT}/vcpkg.exe")
|
||||||
|
else()
|
||||||
|
find_program(VCPKG_EXE "${VCPKG_ROOT}/vcpkg")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,9 +48,10 @@ if (APPLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
message(STATUS "Building for Intel x64 Windows computers")
|
||||||
set(VCPKG_TARGET_TRIPLET x64-windows)
|
set(VCPKG_TARGET_TRIPLET x64-windows)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "toolchain")
|
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "toolchain")
|
||||||
|
|
||||||
project(bridge-gui LANGUAGES CXX)
|
project(bridge-gui LANGUAGES CXX)
|
||||||
|
|
||||||
|
@ -88,7 +95,7 @@ find_package(Qt6 COMPONENTS
|
||||||
Qml
|
Qml
|
||||||
QuickControls2
|
QuickControls2
|
||||||
REQUIRED)
|
REQUIRED)
|
||||||
message(STATUS "Using Qt ${Qt5_VERSION}")
|
message(STATUS "Using Qt ${Qt6_VERSION}")
|
||||||
|
|
||||||
find_program(PROTOC_EXE protoc REQUIRED)
|
find_program(PROTOC_EXE protoc REQUIRED)
|
||||||
message(STATUS "protoc found ${PROTOC_EXE}")
|
message(STATUS "protoc found ${PROTOC_EXE}")
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#error incompatible with your Protocol Buffer headers. Please update
|
#error incompatible with your Protocol Buffer headers. Please update
|
||||||
#error your headers.
|
#error your headers.
|
||||||
#endif
|
#endif
|
||||||
#if 3021002 < PROTOBUF_MIN_PROTOC_VERSION
|
#if 3021003 < PROTOBUF_MIN_PROTOC_VERSION
|
||||||
#error This file was generated by an older version of protoc which is
|
#error This file was generated by an older version of protoc which is
|
||||||
#error incompatible with your Protocol Buffer headers. Please
|
#error incompatible with your Protocol Buffer headers. Please
|
||||||
#error regenerate this file with a newer version of protoc.
|
#error regenerate this file with a newer version of protoc.
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$cmakeExe = "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" # Hardcoded for now.
|
||||||
|
$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)
|
||||||
|
$vcpkgExe = (Join-Path $vcpkgRoot "vcpkg.exe")
|
||||||
|
$vcpkgBootstrap = (Join-Path $vcpkgRoot "bootstrap-vcpkg.bat")
|
||||||
|
|
||||||
|
git submodule update --init --recursive $vcpkgRoot
|
||||||
|
. $vcpkgBootstrap -disableMetrics
|
||||||
|
. $vcpkgExe install grpc:x64-windows
|
||||||
|
. $vcpkgExe upgrade --no-dry-run
|
||||||
|
. $cmakeExe -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE="$buildConfig" -DBRIDGE_APP_VERSION="$bridgeVersion" -S . -B $buildDir
|
||||||
|
. $cmakeExe --build $buildDir
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
# Copyright (c) 2022 Proton AG
|
# Copyright (c) 2022 Proton AG
|
||||||
#
|
#
|
||||||
# This file is part of Proton Mail Bridge.
|
# This file is part of Proton Mail Bridge.
|
||||||
|
@ -16,8 +17,48 @@
|
||||||
# along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
# along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#!/bin/bash
|
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-2.2.1+git} # TODO get the version number from a unified location.
|
||||||
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-2.2.1+git}
|
BUILD_CONFIG=${BRIDGE_GUI_BUILD_CONFIG:-Debug}
|
||||||
BUILD_DIR="./cmake-build-debug"
|
BUILD_DIR=$(echo "./cmake-build-${BUILD_CONFIG}" | tr '[:upper:]' '[:lower:]')
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug -DBRIDGE_APP_VERSION=${BRIDGE_APP_VERSION} -G Ninja -S . -B ${BUILD_DIR}
|
VCPKG_ROOT="../../../extern/vcpkg"
|
||||||
ninja -C ${BUILD_DIR}
|
VCPKG_EXE="${VCPKG_ROOT}/vcpkg"
|
||||||
|
VCPKG_BOOTSTRAP="${VCPKG_ROOT}/bootstrap-vcpkg.sh"
|
||||||
|
|
||||||
|
check_exit() {
|
||||||
|
# shellcheck disable=SC2181
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Process failed: $1"
|
||||||
|
rm -r "$BUILD_DIR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
git submodule update --init --recursive ${VCPKG_ROOT}
|
||||||
|
check_exit "Failed to initialize vcpkg as a submodule."
|
||||||
|
|
||||||
|
${VCPKG_BOOTSTRAP} -disableMetrics
|
||||||
|
check_exit "Failed to bootstrap vcpkg."
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
if [[ "$(uname -m)" == "arm64" ]]; then
|
||||||
|
${VCPKG_EXE} install grpc:arm64-osx
|
||||||
|
check_exit "Failed installing gRPC for macOS / Apple Silicon"
|
||||||
|
fi
|
||||||
|
${VCPKG_EXE} install grpc:x64-osx
|
||||||
|
check_exit "Failed installing gRPC for macOS / Intel x64"
|
||||||
|
elif [[ "$OSTYPE" == "linux"* ]]; then
|
||||||
|
${VCPKG_EXE} install grpc:x64-linux
|
||||||
|
check_exit "Failed installing gRPC for Linux / Intel x64"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "For Windows, use the build.ps1 Powershell script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
${VCPKG_EXE} upgrade --no-dry-run
|
||||||
|
|
||||||
|
cmake -DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" -DBRIDGE_APP_VERSION="${BRIDGE_APP_VERSION}" -G Ninja -S . -B "${BUILD_DIR}"
|
||||||
|
check_exit "CMake failed"
|
||||||
|
|
||||||
|
cmake --build "${BUILD_DIR}"
|
||||||
|
check_exit "build failed"
|
Loading…
Reference in New Issue