Other: grab version number from top-level Makefile.
Other: PowerShell script uses $MyInvocation.MyCommand.Path instead of $PSScriptRoot
This commit is contained in:
parent
34a9d1d125
commit
090aaf8ee3
|
@ -19,16 +19,39 @@
|
|||
include_guard()
|
||||
|
||||
|
||||
if (NOT DEFINED BRIDGE_REPO_ROOT)
|
||||
message(FATAL_ERROR "BRIDGE_REPO_ROOT is not defined.")
|
||||
endif()
|
||||
message(STATUS "BRIDGE_REPO_ROOT is ${BRIDGE_REPO_ROOT}")
|
||||
|
||||
#*****************************************************************************************************************************************************
|
||||
# Bridge version
|
||||
#*****************************************************************************************************************************************************
|
||||
if (NOT DEFINED BRIDGE_APP_VERSION)
|
||||
if (WIN32)
|
||||
find_program(POWERSHELL_EXE powershell.exe)
|
||||
if (NOT POWERSHELL_EXE)
|
||||
message(FATAL_ERROR "PowerShell could not be found.")
|
||||
endif()
|
||||
execute_process(COMMAND "${POWERSHELL_EXE}" -ExecutionPolicy Bypass "${BRIDGE_REPO_ROOT}/utils/bridge_app_version.ps1"
|
||||
OUTPUT_VARIABLE BRIDGE_APP_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
|
||||
else()
|
||||
execute_process(COMMAND "${BRIDGE_REPO_ROOT}/utils/bridge_app_version.sh"
|
||||
OUTPUT_VARIABLE BRIDGE_APP_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY)
|
||||
endif()
|
||||
if (NOT BRIDGE_APP_VERSION)
|
||||
message(FATAL_ERROR "Could not determine BRIDGE_APP_VERSION.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
#****************************************************************************************************************************************************
|
||||
# vcpkg, toolchain, and architecture
|
||||
#****************************************************************************************************************************************************
|
||||
# We rely on vcpkg for to get gRPC / Protobuf
|
||||
# run build.sh / build.ps1 to get gRPC / Protobuf and dependencies installed.
|
||||
|
||||
if (NOT DEFINED VCPKG_ROOT)
|
||||
message(FATAL_ERROR "VCPKG_ROOT is not defined.")
|
||||
endif()
|
||||
|
||||
set(VCPKG_ROOT "${BRIDGE_REPO_ROOT}/extern/vcpkg")
|
||||
message(STATUS "VCPKG_ROOT is ${VCPKG_ROOT}")
|
||||
if (WIN32)
|
||||
find_program(VCPKG_EXE "${VCPKG_ROOT}/vcpkg.exe")
|
||||
|
|
|
@ -22,9 +22,7 @@ cmake_minimum_required(VERSION 3.22)
|
|||
#*****************************************************************************************************************************************************
|
||||
# Project
|
||||
#*****************************************************************************************************************************************************
|
||||
|
||||
|
||||
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../extern/vcpkg")
|
||||
set(BRIDGE_REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
|
||||
include("BridgeSetup.cmake")
|
||||
|
||||
project(frontend)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
|
||||
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../extern/vcpkg")
|
||||
set(BRIDGE_REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
|
||||
include(../BridgeSetup.cmake)
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../extern/vcpkg")
|
||||
set(BRIDGE_REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
|
||||
include(../BridgeSetup.cmake)
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ set(CMAKE_PREFIX_PATH $ENV{QT6DIR} ${CMAKE_PREFIX_PATH})
|
|||
if (DEFINED ENV{BRIDGE_INSTALL_PATH})
|
||||
set(CMAKE_INSTALL_PREFIX "$ENV{BRIDGE_INSTALL_PATH}")
|
||||
else(DEFINED ENV{BRIDGE_INSTALL_PATH})
|
||||
message(status "Using Default install path (${CMAKE_INSTALL_PREFIX}), export BRIDGE_INSTALL_PATH to change it.")
|
||||
message(STATUS "Using Default install path (${CMAKE_INSTALL_PREFIX}), export BRIDGE_INSTALL_PATH to change it.")
|
||||
endif(DEFINED ENV{BRIDGE_INSTALL_PATH})
|
||||
|
||||
if(NOT UNIX)
|
||||
|
|
|
@ -1,24 +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/>.
|
||||
|
||||
|
||||
#ifndef BRIDGE_GUI_CONFIG_H
|
||||
#define BRIDGE_GUI_CONFIG_H
|
||||
|
||||
#cmakedefine ATTACH_MODE @ATTACH_MODE@
|
||||
|
||||
#endif // BRIDGE_GUI_CONFIG_H
|
|
@ -18,9 +18,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
$scriptpath = $MyInvocation.MyCommand.Path
|
||||
$dir = Split-Path $scriptpath
|
||||
Write-host "Bridge-gui directory is $dir"
|
||||
Push-Location $dir
|
||||
$scriptDir = Split-Path $scriptpath
|
||||
$bridgeRepoRootDir = Join-Path $scriptDir "../../../.." -Resolve
|
||||
Write-host "Bridge-gui directory is $scriptDir"
|
||||
Write-host "Bridge repos root dir $bridgeRepoRootDir"
|
||||
Push-Location $scriptDir
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
|
@ -29,10 +31,11 @@ if ($null -eq $cmakeExe)
|
|||
{
|
||||
$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)
|
||||
if ($null -eq $bridgeVersion)
|
||||
{
|
||||
$bridgeVersion = "2.2.1+"
|
||||
$bridgeVersion = . (Join-Path $bridgeRepoRootDir "utils/bridge_app_version.ps1")
|
||||
}
|
||||
$buildConfig = ($env:BRIDGE_GUI_BUILD_CONFIG)
|
||||
if ($null -eq $buildConfig)
|
||||
|
@ -40,8 +43,8 @@ if ($null -eq $buildConfig)
|
|||
$buildConfig = "Debug"
|
||||
}
|
||||
|
||||
$buildDir=(Join-Path $PSScriptRoot "cmake-build-$buildConfig".ToLower())
|
||||
$vcpkgRoot = (Join-Path $PSScriptRoot "../../../../extern/vcpkg" -Resolve)
|
||||
$buildDir=(Join-Path $scriptDir "cmake-build-$buildConfig".ToLower())
|
||||
$vcpkgRoot = (Join-Path $bridgeRepoRootDir "extern/vcpkg" -Resolve)
|
||||
$vcpkgExe = (Join-Path $vcpkgRoot "vcpkg.exe")
|
||||
$vcpkgBootstrap = (Join-Path $vcpkgRoot "bootstrap-vcpkg.bat")
|
||||
|
||||
|
|
|
@ -22,8 +22,9 @@ if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]] ; then
|
|||
fi
|
||||
|
||||
|
||||
BRIDGE_REPO_ROOT="../../../.."
|
||||
BRIDGE_INSTALL_PATH=${BRIDGE_INSTALL_PATH:-deploy}
|
||||
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-2.2.1+git}
|
||||
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-$("${BRIDGE_REPO_ROOT}/utils/bridge_app_version.sh")}
|
||||
BUILD_CONFIG=${BRIDGE_GUI_BUILD_CONFIG:-Debug}
|
||||
BUILD_DIR=$(echo "./cmake-build-${BUILD_CONFIG}" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
|
@ -51,7 +52,7 @@ check_exit() {
|
|||
fi
|
||||
}
|
||||
|
||||
VCPKG_ROOT="../../../../extern/vcpkg"
|
||||
VCPKG_ROOT="${BRIDGE_REPO_ROOT}/extern/vcpkg"
|
||||
|
||||
git submodule update --init --recursive ${VCPKG_ROOT}
|
||||
check_exit "Failed to initialize vcpkg as a submodule."
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../extern/vcpkg")
|
||||
|
||||
set(BRIDGE_REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
|
||||
include(../BridgeSetup.cmake)
|
||||
|
||||
|
||||
|
@ -46,6 +47,7 @@ set(CMAKE_PREFIX_PATH $ENV{QT6DIR} ${CMAKE_PREFIX_PATH})
|
|||
find_package(Qt6 COMPONENTS Core REQUIRED)
|
||||
qt_standard_project_setup()
|
||||
|
||||
|
||||
#****************************************************************************************************************************************************
|
||||
# gRPC / Protobuf
|
||||
#****************************************************************************************************************************************************
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Select-String -Path (Join-Path $PSScriptRoot "../Makefile") -Pattern "^BRIDGE_APP_VERSION\?=(\S*)" |
|
||||
ForEach-Object {$_.Matches} | ForEach-Object { $_.Groups[1].Value }
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
sed -n "s/BRIDGE_APP_VERSION?=\(\S*\)/\1/p" "$(dirname $0)/../Makefile"
|
Loading…
Reference in New Issue