forked from Silverfish/proton-bridge
Other: added vcpkg as a submodule + build scripts
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2022 Proton AG
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
|
||||
#!/bin/bash
|
||||
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-2.2.1+git}
|
||||
BUILD_DIR="./cmake-build-debug"
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DBRIDGE_APP_VERSION=${BRIDGE_APP_VERSION} -G Ninja -S . -B ${BUILD_DIR}
|
||||
ninja -C ${BUILD_DIR}
|
||||
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_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"
|
||||
Reference in New Issue
Block a user