mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
GODT-1675: Update installers [skip-ci]
This commit is contained in:
168
Makefile
168
Makefile
@ -5,9 +5,10 @@ export GO111MODULE=on
|
|||||||
GOOS:=$(shell go env GOOS)
|
GOOS:=$(shell go env GOOS)
|
||||||
TARGET_CMD?=Desktop-Bridge
|
TARGET_CMD?=Desktop-Bridge
|
||||||
TARGET_OS?=${GOOS}
|
TARGET_OS?=${GOOS}
|
||||||
|
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
.PHONY: build build-nogui build-launcher versioner hasher
|
.PHONY: build build-gui build-nogui build-launcher versioner hasher
|
||||||
|
|
||||||
# Keep version hardcoded so app build works also without Git repository.
|
# Keep version hardcoded so app build works also without Git repository.
|
||||||
BRIDGE_APP_VERSION?=2.3.0+git
|
BRIDGE_APP_VERSION?=2.3.0+git
|
||||||
@ -16,7 +17,6 @@ SRC_ICO:=bridge.ico
|
|||||||
SRC_ICNS:=Bridge.icns
|
SRC_ICNS:=Bridge.icns
|
||||||
SRC_SVG:=bridge.svg
|
SRC_SVG:=bridge.svg
|
||||||
EXE_NAME:=proton-bridge
|
EXE_NAME:=proton-bridge
|
||||||
CONFIGNAME:=bridge
|
|
||||||
REVISION:=$(shell git rev-parse --short=10 HEAD)
|
REVISION:=$(shell git rev-parse --short=10 HEAD)
|
||||||
BUILD_TIME:=$(shell date +%FT%T%z)
|
BUILD_TIME:=$(shell date +%FT%T%z)
|
||||||
|
|
||||||
@ -37,23 +37,31 @@ BUILD_FLAGS_GUI+=-ldflags '${GO_LDFLAGS}'
|
|||||||
BUILD_FLAGS_LAUNCHER+=-ldflags '${GO_LDFLAGS_LAUNCHER}'
|
BUILD_FLAGS_LAUNCHER+=-ldflags '${GO_LDFLAGS_LAUNCHER}'
|
||||||
|
|
||||||
DEPLOY_DIR:=cmd/${TARGET_CMD}/deploy
|
DEPLOY_DIR:=cmd/${TARGET_CMD}/deploy
|
||||||
ICO_FILES:=
|
|
||||||
DIRNAME:=$(shell basename ${CURDIR})
|
DIRNAME:=$(shell basename ${CURDIR})
|
||||||
EXE:=${EXE_NAME}
|
EXE:=${EXE_NAME}
|
||||||
EXE_QT:=${DIRNAME}
|
EXE_GO:=bridge
|
||||||
|
EXE_GUI_NAME:=bridge-gui
|
||||||
|
EXE_GUI:=${EXE_GUI_NAME}
|
||||||
|
LAUNCHER_PATH:=./cmd/launcher/
|
||||||
|
LAUNCHER_EXE:=launcher-${EXE}
|
||||||
|
|
||||||
ifeq "${TARGET_OS}" "windows"
|
ifeq "${TARGET_OS}" "windows"
|
||||||
EXE:=${EXE}.exe
|
EXE:=${EXE}.exe
|
||||||
EXE_QT:=${EXE_QT}.exe
|
EXE_GUI:=${EXE_GUI}.exe
|
||||||
|
EXE_GO:=${EXE_GO}.exe
|
||||||
|
LAUNCHER_EXE:=${LAUNCHER_EXE}.exe
|
||||||
RESOURCE_FILE:=resource.syso
|
RESOURCE_FILE:=resource.syso
|
||||||
endif
|
endif
|
||||||
ifeq "${TARGET_OS}" "darwin"
|
ifeq "${TARGET_OS}" "darwin"
|
||||||
DARWINAPP_CONTENTS:=${DEPLOY_DIR}/darwin/${EXE}.app/Contents
|
DARWINAPP_CONTENTS:=${DEPLOY_DIR}/darwin/${EXE}.app/Contents
|
||||||
EXE:=${EXE}.app
|
EXE:=${EXE}.app
|
||||||
EXE_QT:=${EXE_QT}.app
|
EXE_GUI:=${EXE_GUI_NAME}.app
|
||||||
EXE_BINARY_DARWIN:=/Contents/MacOS/${EXE_NAME}
|
EXE_BINARY_DARWIN:=Contents/MacOS/${EXE_NAME}
|
||||||
|
EXE_GO:=${EXE_GUI}/Contents/MacOS/${EXE_GO}
|
||||||
endif
|
endif
|
||||||
EXE_TARGET:=${DEPLOY_DIR}/${TARGET_OS}/${EXE}
|
EXE_TARGET:=${DEPLOY_DIR}/${TARGET_OS}/${EXE}
|
||||||
EXE_QT_TARGET:=${DEPLOY_DIR}/${TARGET_OS}/${EXE_QT}
|
EXE_GUI_TARGET:=${DEPLOY_DIR}/${TARGET_OS}/${EXE_GUI}
|
||||||
|
EXE_GO_TARGET:=${DEPLOY_DIR}/${TARGET_OS}/${EXE_GO}
|
||||||
|
|
||||||
TGZ_TARGET:=bridge_${TARGET_OS}_${REVISION}.tgz
|
TGZ_TARGET:=bridge_${TARGET_OS}_${REVISION}.tgz
|
||||||
|
|
||||||
@ -63,19 +71,23 @@ else
|
|||||||
VENDOR_TARGET=update-vendor
|
VENDOR_TARGET=update-vendor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build: ${TGZ_TARGET}
|
build: build-gui
|
||||||
|
|
||||||
build-nogui: gofiles
|
build-gui: ${TGZ_TARGET}
|
||||||
|
|
||||||
|
build-nogui: ${EXE_NAME}
|
||||||
|
|
||||||
|
${EXE_NAME}: gofiles
|
||||||
go build ${BUILD_FLAGS} -o ${EXE_NAME} cmd/${TARGET_CMD}/main.go
|
go build ${BUILD_FLAGS} -o ${EXE_NAME} cmd/${TARGET_CMD}/main.go
|
||||||
|
|
||||||
ifeq "${GOOS}" "windows"
|
|
||||||
PRERESOURCECMD:=cp ./resource.syso ./cmd/launcher/resource.syso
|
|
||||||
POSTRESOURCECMD:=rm -f ./cmd/launcher/resource.syso
|
|
||||||
endif
|
|
||||||
build-launcher: ${RESOURCE_FILE}
|
build-launcher: ${RESOURCE_FILE}
|
||||||
${PRERESOURCECMD}
|
ifeq "${GOOS}" "windows"
|
||||||
go build ${BUILD_FLAGS_LAUNCHER} -o launcher-${EXE} ./cmd/launcher/
|
powershell Copy-Item ${ROOT_DIR}/${RESOURCE_FILE} ${ROOT_DIR}/${LAUNCHER_PATH}${RESOURCE_FILE}
|
||||||
${POSTRESOURCECMD}
|
endif
|
||||||
|
go build ${BUILD_FLAGS_LAUNCHER} -o ${LAUNCHER_EXE} ${LAUNCHER_PATH}
|
||||||
|
ifeq "${GOOS}" "windows"
|
||||||
|
powershell Remove-Item ${ROOT_DIR}/${LAUNCHER_PATH}${RESOURCE_FILE} -Force
|
||||||
|
endif
|
||||||
|
|
||||||
versioner:
|
versioner:
|
||||||
go build ${BUILD_FLAGS} -o versioner utils/versioner/main.go
|
go build ${BUILD_FLAGS} -o versioner utils/versioner/main.go
|
||||||
@ -85,81 +97,60 @@ hasher:
|
|||||||
|
|
||||||
${TGZ_TARGET}: ${DEPLOY_DIR}/${TARGET_OS}
|
${TGZ_TARGET}: ${DEPLOY_DIR}/${TARGET_OS}
|
||||||
rm -f $@
|
rm -f $@
|
||||||
cd ${DEPLOY_DIR}/${TARGET_OS} && tar -czvf ../../../../$@ .
|
tar -czvf $@ -C ${DEPLOY_DIR}/${TARGET_OS} .
|
||||||
|
|
||||||
${DEPLOY_DIR}/linux: ${EXE_TARGET}
|
${DEPLOY_DIR}/linux: ${EXE_TARGET} build-launcher
|
||||||
cp -pf ./dist/${SRC_SVG} ${DEPLOY_DIR}/linux/logo.svg
|
cp -pf ./dist/${SRC_SVG} ${DEPLOY_DIR}/linux/logo.svg
|
||||||
cp -pf ./LICENSE ${DEPLOY_DIR}/linux/
|
cp -pf ./LICENSE ${DEPLOY_DIR}/linux/
|
||||||
cp -pf ./Changelog.md ${DEPLOY_DIR}/linux/
|
cp -pf ./Changelog.md ${DEPLOY_DIR}/linux/
|
||||||
cp -pf ./dist/${EXE_NAME}.desktop ${DEPLOY_DIR}/linux/
|
cp -pf ./dist/${EXE_NAME}.desktop ${DEPLOY_DIR}/linux/
|
||||||
|
cp -pf ${LAUNCHER_EXE} ${DEPLOY_DIR}/linux/
|
||||||
|
|
||||||
${DEPLOY_DIR}/darwin: ${EXE_TARGET}
|
${DEPLOY_DIR}/darwin: ${EXE_TARGET} build-launcher
|
||||||
if [ "${DIRNAME}" != "${EXE_NAME}" ]; then \
|
mv ${EXE_TARGET}/Contents/MacOS/{${EXE_GUI_NAME},${EXE_NAME}}
|
||||||
mv ${EXE_TARGET}/Contents/MacOS/{${DIRNAME},${EXE_NAME}}; \
|
perl -i -pe"s/>${EXE_GUI_NAME}/>${LAUNCHER_EXE}/g" ${ROOT_DIR}/${EXE_TARGET}/Contents/Info.plist
|
||||||
perl -i -pe"s/>${DIRNAME}/>${EXE_NAME}/g" ${EXE_TARGET}/Contents/Info.plist; \
|
|
||||||
fi
|
|
||||||
cp ./dist/${SRC_ICNS} ${DARWINAPP_CONTENTS}/Resources/${SRC_ICNS}
|
cp ./dist/${SRC_ICNS} ${DARWINAPP_CONTENTS}/Resources/${SRC_ICNS}
|
||||||
cp LICENSE ${DARWINAPP_CONTENTS}/Resources/
|
cp LICENSE ${DARWINAPP_CONTENTS}/Resources/
|
||||||
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebEngine.framework"
|
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebEngine.framework"
|
||||||
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebView.framework"
|
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebView.framework"
|
||||||
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebEngineCore.framework"
|
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebEngineCore.framework"
|
||||||
./utils/remove_non_relative_links_darwin.sh "${EXE_TARGET}${EXE_BINARY_DARWIN}"
|
cp ${LAUNCHER_EXE} ${EXE_TARGET}/Contents/MacOS/${LAUNCHER_EXE}
|
||||||
|
./utils/remove_non_relative_links_darwin.sh "${EXE_TARGET}/${EXE_BINARY_DARWIN}"
|
||||||
|
|
||||||
${DEPLOY_DIR}/windows: ${EXE_TARGET}
|
${DEPLOY_DIR}/windows: ${EXE_TARGET} build-launcher
|
||||||
cp ./dist/${SRC_ICO} ${DEPLOY_DIR}/windows/logo.ico
|
cp ./dist/${SRC_ICO} ${DEPLOY_DIR}/windows/logo.ico
|
||||||
cp LICENSE ${DEPLOY_DIR}/windows/
|
cp LICENSE ${DEPLOY_DIR}/windows/
|
||||||
|
cp ${LAUNCHER_EXE} ${DEPLOY_DIR}/windows/$(notdir ${LAUNCHER_EXE})
|
||||||
|
# plugins are installed in a plugins folder while needs to be near the exe
|
||||||
|
mv ${DEPLOY_DIR}/windows/plugins/* ${DEPLOY_DIR}/windows/.
|
||||||
|
rm -rf ${DEPLOY_DIR}/windows/plugins
|
||||||
|
|
||||||
QT_BUILD_TARGET:=build desktop
|
${EXE_TARGET}: check-build-essentials ${EXE_NAME}
|
||||||
ifneq "${GOOS}" "${TARGET_OS}"
|
# TODO: resource.syso for windows
|
||||||
ifeq "${TARGET_OS}" "windows"
|
cd internal/frontend/bridge-gui/bridge-gui && \
|
||||||
QT_BUILD_TARGET:=-docker build windows_64_shared
|
BRIDGE_APP_VERSION=${APP_VERSION} \
|
||||||
endif
|
BRIDGE_REVISION=${REVISION} \
|
||||||
endif
|
BRIDGE_BUILD_TIME=${BUILD_TIME} \
|
||||||
|
BRIDGE_GUI_BUILD_CONFIG=Release \
|
||||||
${EXE_TARGET}: check-has-go gofiles ${RESOURCE_FILE} ${VENDOR_TARGET}
|
BRIDGE_INSTALL_PATH=${ROOT_DIR}/${DEPLOY_DIR}/${GOOS} \
|
||||||
rm -rf deploy ${TARGET_OS} ${DEPLOY_DIR}
|
./build.sh install
|
||||||
cp cmd/${TARGET_CMD}/main.go .
|
cp -pf "${ROOT_DIR}/${EXE_NAME}" "$(ROOT_DIR)/${EXE_GO_TARGET}"
|
||||||
qtdeploy ${BUILD_FLAGS_GUI} ${QT_BUILD_TARGET}
|
mv "${ROOT_DIR}/${EXE_GUI_TARGET}" "$(ROOT_DIR)/${EXE_TARGET}"
|
||||||
mv deploy cmd/${TARGET_CMD}
|
|
||||||
if [ "${EXE_QT_TARGET}" != "${EXE_TARGET}" ]; then mv ${EXE_QT_TARGET} ${EXE_TARGET}; fi
|
|
||||||
rm -rf ${TARGET_OS} main.go
|
|
||||||
|
|
||||||
|
|
||||||
WINDRES_YEAR:=$(shell date +%Y)
|
WINDRES_YEAR:=$(shell date +%Y)
|
||||||
APP_VERSION_COMMA:=$(shell echo "${APP_VERSION}" | sed -e 's/[^0-9,.]*//g' -e 's/\./,/g')
|
APP_VERSION_COMMA:=$(shell echo "${APP_VERSION}" | sed -e 's/[^0-9,.]*//g' -e 's/\./,/g')
|
||||||
resource.syso: ./dist/info.rc ./dist/${SRC_ICO} .FORCE
|
${RESOURCE_FILE}: ./dist/info.rc ./dist/${SRC_ICO} .FORCE
|
||||||
rm -f ./*.syso
|
rm -f ./*.syso
|
||||||
windres --target=pe-x86-64 -I ./internal/frontend/share/ -D ICO_FILE=${SRC_ICO} -D EXE_NAME="${EXE_NAME}" -D FILE_VERSION="${APP_VERSION}" -D ORIGINAL_FILE_NAME="${EXE}" -D PRODUCT_VERSION="${APP_VERSION}" -D FILE_VERSION_COMMA=${APP_VERSION_COMMA} -D YEAR=${WINDRES_YEAR} -o $@ $<
|
windres --target=pe-x86-64 \
|
||||||
|
-I ./internal/frontend/share/ \
|
||||||
## Rules for therecipe/qt
|
-D ICO_FILE=${SRC_ICO} \
|
||||||
.PHONY: prepare-vendor update-vendor update-qt-docs
|
-D EXE_NAME="${EXE_NAME}" \
|
||||||
THERECIPE_ENV:=github.com/therecipe/env_${TARGET_OS}_amd64_513
|
-D FILE_VERSION="${APP_VERSION}" \
|
||||||
|
-D ORIGINAL_FILE_NAME="${EXE}" \
|
||||||
# vendor folder will be deleted by gomod hence we cache the big repo
|
-D PRODUCT_VERSION="${APP_VERSION}" \
|
||||||
# therecipe/env in order to download it only once
|
-D FILE_VERSION_COMMA=${APP_VERSION_COMMA} \
|
||||||
vendor-cache/${THERECIPE_ENV}:
|
-D YEAR=${WINDRES_YEAR} \
|
||||||
git clone https://${THERECIPE_ENV}.git vendor-cache/${THERECIPE_ENV}
|
-o ./${RESOURCE_FILE} $<
|
||||||
if [ "${TARGET_OS}" == "darwin" ]; then cp -f "./utils/QTBUG-88600/libqcocoa.dylib" "./vendor-cache/${THERECIPE_ENV}/5.13.0/clang_64/plugins/platforms/"; fi;
|
|
||||||
|
|
||||||
# The command used to make symlinks is different on windows.
|
|
||||||
# So if the GOOS is windows and we aren't crossbuilding (in which case the host os would still be *nix)
|
|
||||||
# we need to change the LINKCMD to something windowsy.
|
|
||||||
LINKCMD:=ln -sf ${CURDIR}/vendor-cache/${THERECIPE_ENV} vendor/${THERECIPE_ENV}
|
|
||||||
ifeq "${GOOS}" "windows"
|
|
||||||
WINDIR:=$(subst /c/,c:\\,${CURDIR})/vendor-cache/${THERECIPE_ENV}
|
|
||||||
LINKCMD:=cmd //c 'mklink $(subst /,\,vendor\${THERECIPE_ENV} ${WINDIR})'
|
|
||||||
endif
|
|
||||||
|
|
||||||
prepare-vendor:
|
|
||||||
go install -v -tags=no_env github.com/therecipe/qt/cmd/...
|
|
||||||
go mod vendor
|
|
||||||
|
|
||||||
# update-vendor is PHONY because we need to make sure that we always have updated vendor
|
|
||||||
update-vendor: vendor-cache/${THERECIPE_ENV} prepare-vendor
|
|
||||||
${LINKCMD}
|
|
||||||
|
|
||||||
update-qt-docs:
|
|
||||||
go get github.com/therecipe/qt/internal/binding/files/docs/$(QT_API)
|
|
||||||
|
|
||||||
## Dev dependencies
|
## Dev dependencies
|
||||||
.PHONY: install-devel-tools install-linter install-go-mod-outdated install-git-hooks
|
.PHONY: install-devel-tools install-linter install-go-mod-outdated install-git-hooks
|
||||||
@ -184,10 +175,23 @@ install-git-hooks:
|
|||||||
chmod +x .git/hooks/*
|
chmod +x .git/hooks/*
|
||||||
|
|
||||||
## Checks, mocks and docs
|
## Checks, mocks and docs
|
||||||
.PHONY: check-has-go add-license change-copyright-year test bench coverage mocks lint-license lint-golang lint updates doc release-notes
|
.PHONY: check-has-go check-build-essentials add-license change-copyright-year test bench coverage mocks lint-license lint-golang lint updates doc release-notes
|
||||||
check-has-go:
|
check-has-go:
|
||||||
@which go || (echo "Install Go-lang!" && exit 1)
|
@which go || (echo "Install Go-lang!" && exit 1)
|
||||||
|
|
||||||
|
|
||||||
|
check_is_installed=if ! which $(1) > /dev/null; then echo "Please install $(1)"; exit 1; fi
|
||||||
|
check-build-essentials: check-qt-dir
|
||||||
|
@$(call check_is_installed,zip)
|
||||||
|
@$(call check_is_installed,unzip)
|
||||||
|
@$(call check_is_installed,tar)
|
||||||
|
@$(call check_is_installed,curl)
|
||||||
|
@$(call check_is_installed,cmake)
|
||||||
|
@$(call check_is_installed,ninja)
|
||||||
|
|
||||||
|
check-qt-dir:
|
||||||
|
@if ! ls "${QT6DIR}/bin/qt.conf" > /dev/null; then echo "Please set QT6DIR"; exit 1; fi
|
||||||
|
|
||||||
add-license:
|
add-license:
|
||||||
./utils/missing_license.sh add
|
./utils/missing_license.sh add
|
||||||
|
|
||||||
@ -304,15 +308,27 @@ clean-frontend-qt:
|
|||||||
clean-vendor: clean-frontend-qt clean-frontend-qt-common
|
clean-vendor: clean-frontend-qt clean-frontend-qt-common
|
||||||
rm -rf ./vendor
|
rm -rf ./vendor
|
||||||
|
|
||||||
clean: clean-vendor
|
clean-gui:
|
||||||
|
cd internal/frontend/bridge-gui/ && \
|
||||||
|
rm -f Version.h && \
|
||||||
|
rm -rf cmake-build-*/
|
||||||
|
|
||||||
|
clean-vcpkg:
|
||||||
|
git submodule deinit -f ./extern/vcpkg
|
||||||
|
rm -rf ./.git/submodule/vcpkg
|
||||||
|
rm -rf ./extern/vcpkg
|
||||||
|
git checkout -- extern/vcpkg
|
||||||
|
|
||||||
|
clean: clean-vendor clean-gui clean-vcpkg
|
||||||
rm -rf vendor-cache
|
rm -rf vendor-cache
|
||||||
rm -rf cmd/Desktop-Bridge/deploy
|
rm -rf cmd/Desktop-Bridge/deploy
|
||||||
rm -rf cmd/Import-Export/deploy
|
rm -rf cmd/Import-Export/deploy
|
||||||
rm -f build last.log mem.pprof main.go
|
rm -f build last.log mem.pprof main.go
|
||||||
rm -f resource.syso
|
rm -f ${RESOURCE_FILE}
|
||||||
rm -f release-notes/bridge.html
|
rm -f release-notes/bridge.html
|
||||||
rm -f release-notes/import-export.html
|
rm -f release-notes/import-export.html
|
||||||
|
|
||||||
|
|
||||||
.PHONY: generate
|
.PHONY: generate
|
||||||
generate:
|
generate:
|
||||||
go generate ./...
|
go generate ./...
|
||||||
|
|||||||
@ -41,8 +41,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
appName = "Proton Mail Launcher"
|
appName = "Proton Mail Launcher"
|
||||||
configName = "bridge"
|
configName = "bridge"
|
||||||
exeName = "proton-bridge"
|
exeName = "bridge"
|
||||||
guiName = "proton-bridge-gui"
|
guiName = "proton-bridge"
|
||||||
|
|
||||||
FlagCLI = "--cli"
|
FlagCLI = "--cli"
|
||||||
FlagLauncher = "--launcher"
|
FlagLauncher = "--launcher"
|
||||||
|
|||||||
3
internal/frontend/.gitignore
vendored
3
internal/frontend/.gitignore
vendored
@ -10,5 +10,4 @@ rcc_cgo_*.go
|
|||||||
*.qmlc
|
*.qmlc
|
||||||
|
|
||||||
# Generated file
|
# Generated file
|
||||||
bridge-gui/Version.h
|
bridge-gui/bridge-gui/Version.h
|
||||||
bridge-gui/Config.h
|
|
||||||
|
|||||||
@ -56,6 +56,19 @@ if (NOT DEFINED ENV{QT6DIR})
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_PREFIX_PATH $ENV{QT6DIR} ${CMAKE_PREFIX_PATH})
|
set(CMAKE_PREFIX_PATH $ENV{QT6DIR} ${CMAKE_PREFIX_PATH})
|
||||||
|
|
||||||
|
# Use CMAKE_INSTALL_PREFIX that is also used internally by CMake
|
||||||
|
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.")
|
||||||
|
endif(DEFINED ENV{BRIDGE_INSTALL_PATH})
|
||||||
|
|
||||||
|
if(NOT UNIX)
|
||||||
|
# To change the value of QT_DEPLOY_BIN_DIR, ensure that the project sets CMAKE_INSTALL_BINDIR before the Core package is found.
|
||||||
|
set(CMAKE_INSTALL_BINDIR ".")
|
||||||
|
endif(NOT UNIX)
|
||||||
|
|
||||||
find_package(Qt6 COMPONENTS Core Quick Qml QuickControls2 REQUIRED)
|
find_package(Qt6 COMPONENTS Core Quick Qml QuickControls2 REQUIRED)
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
@ -66,11 +79,10 @@ message(STATUS "Using Qt ${Qt6_VERSION}")
|
|||||||
# Source files and output
|
# Source files and output
|
||||||
#*****************************************************************************************************************************************************
|
#*****************************************************************************************************************************************************
|
||||||
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Version.h)
|
||||||
|
|
||||||
if (NOT TARGET bridgepp)
|
if (NOT TARGET bridgepp)
|
||||||
add_subdirectory(../bridgepp bridgepp)
|
add_subdirectory(../bridgepp bridgepp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
@ -79,6 +91,10 @@ else()
|
|||||||
set(DOCK_ICON_SRC_FILE DockIcon/DockIcon.cpp)
|
set(DOCK_ICON_SRC_FILE DockIcon/DockIcon.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/lib" )
|
||||||
|
endif(UNIX)
|
||||||
|
|
||||||
add_executable(bridge-gui
|
add_executable(bridge-gui
|
||||||
Resources.qrc
|
Resources.qrc
|
||||||
AppController.cpp AppController.h
|
AppController.cpp AppController.h
|
||||||
@ -102,5 +118,35 @@ target_link_libraries(bridge-gui
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
target_link_libraries(bridge-gui ${COCOA_LIBRARY})
|
target_link_libraries(bridge-gui ${COCOA_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#*****************************************************************************************************************************************************
|
||||||
|
# Deploy
|
||||||
|
#*****************************************************************************************************************************************************
|
||||||
|
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
||||||
|
|
||||||
|
set_target_properties(bridge-gui PROPERTIES
|
||||||
|
WIN32_EXECUTABLE TRUE
|
||||||
|
MACOSX_BUNDLE TRUE)
|
||||||
|
|
||||||
|
install(TARGETS bridge-gui
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||||
|
BUNDLE DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_generate_deploy_app_script(
|
||||||
|
TARGET bridge-gui
|
||||||
|
FILENAME_VARIABLE deploy_script
|
||||||
|
NO_UNSUPPORTED_PLATFORM_ERROR)
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
set(DEPLOY_OS Linux)
|
||||||
|
elseif(APPLE)
|
||||||
|
set(DEPLOY_OS Darwin)
|
||||||
|
else()
|
||||||
|
set(DEPLOY_OS Windows)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(Deploy${DEPLOY_OS}.cmake)
|
||||||
49
internal/frontend/bridge-gui/bridge-gui/DeployDarwin.cmake
Normal file
49
internal/frontend/bridge-gui/bridge-gui/DeployDarwin.cmake
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
|
#*****************************************************************************************************************************************************
|
||||||
|
# Deploy
|
||||||
|
#*****************************************************************************************************************************************************
|
||||||
|
|
||||||
|
install(SCRIPT ${deploy_script})
|
||||||
|
|
||||||
|
# QML
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/qml/Qt"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/MacOS")
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/qml/QtQml"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/MacOS")
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/qml/QtQuick"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/MacOS")
|
||||||
|
# FRAMEWORKS
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/lib/QtQmlWorkerScript.framework"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/Frameworks")
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/lib/QtQuickControls2Impl.framework"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/Frameworks")
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/lib/QtQuickLayouts.framework"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/Frameworks")
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/lib/QtQuickDialogs2.framework"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/Frameworks")
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/lib/QtQuickDialogs2QuickImpl.framework"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/Frameworks")
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/lib/QtQuickDialogs2Utils.framework"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/Frameworks")
|
||||||
|
# PLUGINS
|
||||||
|
install(FILES "$ENV{QT6DIR}/plugins/imageformats/libqsvg.dylib"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/PlugIns/imageformats")
|
||||||
|
|
||||||
71
internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake
Normal file
71
internal/frontend/bridge-gui/bridge-gui/DeployLinux.cmake
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
|
#*****************************************************************************************************************************************************
|
||||||
|
# Deploy
|
||||||
|
#*****************************************************************************************************************************************************
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_BINDIR}" "${CMAKE_INSTALL_LIBDIR}" "." "../lib")
|
||||||
|
install(DIRECTORY "$ENV{QT6DIR}/qml" "$ENV{QT6DIR}/plugins"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
|
macro( AppendLib LIB_NAME HINT_PATH)
|
||||||
|
string(TOUPPER ${LIB_NAME} UP_NAME)
|
||||||
|
|
||||||
|
find_library(PATH_${UP_NAME} ${LIB_NAME} HINTS "${HINT_PATH}")
|
||||||
|
|
||||||
|
if( ${PATH_${UP_NAME}} STREQUAL "PATH_${UP_NAME}-NOTFOUND")
|
||||||
|
message(SEND_ERROR "${LIB_NAME} was not found in ${HINT_PATH}")
|
||||||
|
else()
|
||||||
|
get_filename_component(REAL_PATH_${UP_NAME} ${PATH_${UP_NAME}} REALPATH)
|
||||||
|
list(APPEND DEPLOY_LIBS ${PATH_${UP_NAME}})
|
||||||
|
list(APPEND DEPLOY_LIBS ${REAL_PATH_${UP_NAME}})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro( AppendQt6Lib LIB_NAME)
|
||||||
|
AppendLib("${LIB_NAME}" "$ENV{QT6DIR}/lib/")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#Qt6
|
||||||
|
AppendQt6Lib("libQt6QuickControls2.so.6")
|
||||||
|
AppendQt6Lib("libQt6Quick.so.6")
|
||||||
|
AppendQt6Lib("libQt6QmlModels.so.6")
|
||||||
|
AppendQt6Lib("libQt6Qml.so.6")
|
||||||
|
AppendQt6Lib("libQt6Network.so.6")
|
||||||
|
AppendQt6Lib("libQt6OpenGL.so.6")
|
||||||
|
AppendQt6Lib("libQt6Gui.so.6")
|
||||||
|
AppendQt6Lib("libQt6Core.so.6")
|
||||||
|
AppendQt6Lib("libQt6QuickTemplates2.so.6")
|
||||||
|
AppendQt6Lib("libQt6DBus.so.6")
|
||||||
|
AppendQt6Lib("libicui18n.so.56")
|
||||||
|
AppendQt6Lib("libicuuc.so.56")
|
||||||
|
AppendQt6Lib("libicudata.so.56")
|
||||||
|
AppendQt6Lib("libQt6XcbQpa.so.6")
|
||||||
|
# QML dependencies
|
||||||
|
AppendQt6Lib("libQt6QmlWorkerScript.so.6")
|
||||||
|
AppendQt6Lib("libQt6Widgets.so.6")
|
||||||
|
AppendQt6Lib("libQt6QuickControls2Impl.so.6")
|
||||||
|
AppendQt6Lib("libQt6QuickLayouts.so.6")
|
||||||
|
AppendQt6Lib("libQt6QuickDialogs2.so.6")
|
||||||
|
AppendQt6Lib("libQt6QuickDialogs2QuickImpl.so.6")
|
||||||
|
AppendQt6Lib("libQt6QuickDialogs2Utils.so.6")
|
||||||
|
AppendQt6Lib("libQt6Svg.so.6")
|
||||||
|
|
||||||
|
install(FILES ${DEPLOY_LIBS} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
77
internal/frontend/bridge-gui/bridge-gui/DeployWindows.cmake
Normal file
77
internal/frontend/bridge-gui/bridge-gui/DeployWindows.cmake
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
|
#*****************************************************************************************************************************************************
|
||||||
|
# Deploy
|
||||||
|
#*****************************************************************************************************************************************************
|
||||||
|
|
||||||
|
install(SCRIPT ${deploy_script})
|
||||||
|
|
||||||
|
macro( AppendLib LIB_NAME HINT_PATH)
|
||||||
|
string(TOUPPER ${LIB_NAME} UP_NAME)
|
||||||
|
|
||||||
|
find_file(PATH_${UP_NAME} ${LIB_NAME} HINTS "${HINT_PATH}")
|
||||||
|
|
||||||
|
if( ${PATH_${UP_NAME}} STREQUAL "PATH_${UP_NAME}-NOTFOUND")
|
||||||
|
message(SEND_ERROR "${LIB_NAME} was not found in ${HINT_PATH}")
|
||||||
|
else()
|
||||||
|
list(APPEND DEPLOY_LIBS ${PATH_${UP_NAME}})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro( AppendVCPKGLib LIB_NAME)
|
||||||
|
AppendLib("${LIB_NAME}" "${VCPKG_ROOT}/installed/x64-windows/bin")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
cmake_path(CONVERT $ENV{QT6DIR} TO_CMAKE_PATH_LIST QT6DIR)
|
||||||
|
macro( AppendQt6Lib LIB_NAME)
|
||||||
|
AppendLib("${LIB_NAME}" "${QT6DIR}/bin")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Force plugins to be installed near the exe.
|
||||||
|
install(SCRIPT ${deploy_script})
|
||||||
|
|
||||||
|
# Vcpkg DLLs
|
||||||
|
AppendVCPKGLib("abseil_dll.dll")
|
||||||
|
AppendVCPKGLib("cares.dll")
|
||||||
|
AppendVCPKGLib("libcrypto-3-x64.dll")
|
||||||
|
AppendVCPKGLib("libprotobuf.dll")
|
||||||
|
AppendVCPKGLib("libssl-3-x64.dll")
|
||||||
|
AppendVCPKGLib("re2.dll")
|
||||||
|
AppendVCPKGLib("zlib1.dll")
|
||||||
|
# QML DLLs
|
||||||
|
AppendQt6Lib("Qt6QmlWorkerScript.dll")
|
||||||
|
AppendQt6Lib("Qt6Widgets.dll")
|
||||||
|
AppendQt6Lib("Qt6QuickControls2Impl.dll")
|
||||||
|
AppendQt6Lib("Qt6QuickLayouts.dll")
|
||||||
|
AppendQt6Lib("Qt6QuickDialogs2.dll")
|
||||||
|
AppendQt6Lib("Qt6QuickDialogs2QuickImpl.dll")
|
||||||
|
AppendQt6Lib("Qt6QuickDialogs2Utils.dll")
|
||||||
|
|
||||||
|
install(FILES ${DEPLOY_LIBS} DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
|
# QML PlugIns
|
||||||
|
install(DIRECTORY ${QT6DIR}/qml/Qt/labs/platform DESTINATION "${CMAKE_INSTALL_PREFIX}/Qt/labs/")
|
||||||
|
install(DIRECTORY ${QT6DIR}/qml/QtQml DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
install(DIRECTORY ${QT6DIR}/qml/QtQuick DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
|
# Runtime system libs
|
||||||
|
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
||||||
|
include(InstallRequiredSystemLibraries)
|
||||||
|
install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
@ -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_VERSION_H
|
|
||||||
#define BRIDGE_GUI_VERSION_H
|
|
||||||
|
|
||||||
#define PROJECT_VER "2.2.2+git"
|
|
||||||
|
|
||||||
#endif // BRIDGE_GUI_VERSION_H
|
|
||||||
@ -19,6 +19,8 @@
|
|||||||
#ifndef BRIDGE_GUI_VERSION_H
|
#ifndef BRIDGE_GUI_VERSION_H
|
||||||
#define BRIDGE_GUI_VERSION_H
|
#define BRIDGE_GUI_VERSION_H
|
||||||
|
|
||||||
#define PROJECT_VER "@BRIDGE_APP_VERSION@"
|
#define PROJECT_VER "@BRIDGE_APP_VERSION@"
|
||||||
|
#define PROJECT_REVISION "@BRIDGE_REVISION@"
|
||||||
|
#define PROJECT_BUILD_TIME "@BRIDGE_BUILD_TIME@"
|
||||||
|
|
||||||
#endif // BRIDGE_GUI_VERSION_H
|
#endif // BRIDGE_GUI_VERSION_H
|
||||||
|
|||||||
@ -17,19 +17,59 @@
|
|||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
$scriptpath = $MyInvocation.MyCommand.Path
|
||||||
|
$dir = Split-Path $scriptpath
|
||||||
|
Write-host "Bridge-gui directory is $dir"
|
||||||
|
Push-Location $dir
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
$cmakeExe = "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" # Hardcoded for now.
|
$cmakeExe=$(Get-Command cmake).source
|
||||||
$bridgeVersion = ($env:BRIDGE_APP_VERSION ??= "2.2.1+") # TODO get the version number from a unified location.
|
if ($null -eq $cmakeExe)
|
||||||
$buildConfig = ($env:BRIDGE_GUI_BUILD_CONFIG ??= "Debug")
|
{
|
||||||
$buildDir=(Join-Path $PSScriptRoot "cmake-build-$buildConfig-visual-studio".ToLower())
|
$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+"
|
||||||
|
}
|
||||||
|
$buildConfig = ($env:BRIDGE_GUI_BUILD_CONFIG)
|
||||||
|
if ($null -eq $buildConfig)
|
||||||
|
{
|
||||||
|
$buildConfig = "Debug"
|
||||||
|
}
|
||||||
|
|
||||||
|
$buildDir=(Join-Path $PSScriptRoot "cmake-build-$buildConfig".ToLower())
|
||||||
$vcpkgRoot = (Join-Path $PSScriptRoot "../../../../extern/vcpkg" -Resolve)
|
$vcpkgRoot = (Join-Path $PSScriptRoot "../../../../extern/vcpkg" -Resolve)
|
||||||
$vcpkgExe = (Join-Path $vcpkgRoot "vcpkg.exe")
|
$vcpkgExe = (Join-Path $vcpkgRoot "vcpkg.exe")
|
||||||
$vcpkgBootstrap = (Join-Path $vcpkgRoot "bootstrap-vcpkg.bat")
|
$vcpkgBootstrap = (Join-Path $vcpkgRoot "bootstrap-vcpkg.bat")
|
||||||
|
|
||||||
|
function check_exit() {
|
||||||
|
if ($? -ne $True)
|
||||||
|
{
|
||||||
|
Write-Host "Process failed: $args[0]"
|
||||||
|
Remove-Item "$buildDir" -Recurse
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
git submodule update --init --recursive $vcpkgRoot
|
git submodule update --init --recursive $vcpkgRoot
|
||||||
. $vcpkgBootstrap -disableMetrics
|
. $vcpkgBootstrap -disableMetrics
|
||||||
. $vcpkgExe install grpc:x64-windows
|
. $vcpkgExe install grpc:x64-windows --clean-after-build
|
||||||
. $vcpkgExe upgrade --no-dry-run
|
. $vcpkgExe upgrade --no-dry-run
|
||||||
. $cmakeExe -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE="$buildConfig" -DBRIDGE_APP_VERSION="$bridgeVersion" -S . -B $buildDir
|
. $cmakeExe -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE="$buildConfig" -DBRIDGE_APP_VERSION="$bridgeVersion" -S . -B $buildDir
|
||||||
. $cmakeExe --build $buildDir
|
check_exit "CMake failed"
|
||||||
|
. $cmakeExe --build $buildDir --config "$buildConfig"
|
||||||
|
check_exit "Build failed"
|
||||||
|
|
||||||
|
if ($($args.count) -gt 0 )
|
||||||
|
{
|
||||||
|
if ($args[0] = "install")
|
||||||
|
{
|
||||||
|
. $cmakeExe --install $buildDir
|
||||||
|
check_exit "Install failed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pop-Location
|
||||||
|
|||||||
@ -16,49 +16,85 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# 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/>.
|
# along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]] ; then
|
||||||
|
Powershell.exe -File build.ps1 "$@"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-2.2.1+git} # TODO get the version number from a unified location.
|
|
||||||
|
BRIDGE_INSTALL_PATH=${BRIDGE_INSTALL_PATH:-deploy}
|
||||||
|
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-2.2.1+git}
|
||||||
BUILD_CONFIG=${BRIDGE_GUI_BUILD_CONFIG:-Debug}
|
BUILD_CONFIG=${BRIDGE_GUI_BUILD_CONFIG:-Debug}
|
||||||
BUILD_DIR=$(echo "./cmake-build-${BUILD_CONFIG}" | tr '[:upper:]' '[:lower:]')
|
BUILD_DIR=$(echo "./cmake-build-${BUILD_CONFIG}" | tr '[:upper:]' '[:lower:]')
|
||||||
VCPKG_ROOT="../../../../extern/vcpkg"
|
|
||||||
VCPKG_EXE="${VCPKG_ROOT}/vcpkg"
|
realpath() {
|
||||||
VCPKG_BOOTSTRAP="${VCPKG_ROOT}/bootstrap-vcpkg.sh"
|
START_DIR=$PWD
|
||||||
|
BASENAME="$(basename "$1")"
|
||||||
|
cd "$(dirname "$1")" || exit
|
||||||
|
LNK="$(readlink "$BASENAME")"
|
||||||
|
while [ "$LNK" ]; do
|
||||||
|
BASENAME="$(basename "$LNK")"
|
||||||
|
cd "$(dirname "$LNK")" || exit
|
||||||
|
LNK="$(readlink "$BASENAME")"
|
||||||
|
done
|
||||||
|
REALPATH="$PWD/$BASENAME"
|
||||||
|
cd "$START_DIR" || exit
|
||||||
|
echo "$REALPATH"
|
||||||
|
}
|
||||||
|
|
||||||
check_exit() {
|
check_exit() {
|
||||||
# shellcheck disable=SC2181
|
# shellcheck disable=SC2181
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Process failed: $1"
|
echo "Process failed: $1"
|
||||||
rm -r "$BUILD_DIR"
|
rm -r "$BUILD_DIR"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VCPKG_ROOT="../../../../extern/vcpkg"
|
||||||
|
|
||||||
git submodule update --init --recursive ${VCPKG_ROOT}
|
git submodule update --init --recursive ${VCPKG_ROOT}
|
||||||
check_exit "Failed to initialize vcpkg as a submodule."
|
check_exit "Failed to initialize vcpkg as a submodule."
|
||||||
|
|
||||||
|
echo submodule udpated
|
||||||
|
|
||||||
|
VCPKG_ROOT=$(realpath "$VCPKG_ROOT")
|
||||||
|
VCPKG_EXE="${VCPKG_ROOT}/vcpkg"
|
||||||
|
VCPKG_BOOTSTRAP="${VCPKG_ROOT}/bootstrap-vcpkg.sh"
|
||||||
|
|
||||||
|
|
||||||
${VCPKG_BOOTSTRAP} -disableMetrics
|
${VCPKG_BOOTSTRAP} -disableMetrics
|
||||||
check_exit "Failed to bootstrap vcpkg."
|
check_exit "Failed to bootstrap vcpkg."
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
if [[ "$(uname -m)" == "arm64" ]]; then
|
if [[ "$(uname -m)" == "arm64" ]]; then
|
||||||
${VCPKG_EXE} install grpc:arm64-osx
|
${VCPKG_EXE} install grpc:arm64-osx --clean-after-build
|
||||||
check_exit "Failed installing gRPC for macOS / Apple Silicon"
|
check_exit "Failed installing gRPC for macOS / Apple Silicon"
|
||||||
fi
|
fi
|
||||||
${VCPKG_EXE} install grpc:x64-osx
|
${VCPKG_EXE} install grpc:x64-osx --clean-after-build
|
||||||
check_exit "Failed installing gRPC for macOS / Intel x64"
|
check_exit "Failed installing gRPC for macOS / Intel x64"
|
||||||
elif [[ "$OSTYPE" == "linux"* ]]; then
|
elif [[ "$OSTYPE" == "linux"* ]]; then
|
||||||
${VCPKG_EXE} install grpc:x64-linux
|
${VCPKG_EXE} install grpc:x64-linux --clean-after-build
|
||||||
check_exit "Failed installing gRPC for Linux / Intel x64"
|
check_exit "Failed installing gRPC for Linux / Intel x64"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "For Windows, use the build.ps1 Powershell script."
|
echo "For Windows, use the build.ps1 Powershell script."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${VCPKG_EXE} upgrade --no-dry-run
|
${VCPKG_EXE} upgrade --no-dry-run
|
||||||
|
|
||||||
cmake -DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" -DBRIDGE_APP_VERSION="${BRIDGE_APP_VERSION}" -G Ninja -S . -B "${BUILD_DIR}"
|
cmake \
|
||||||
|
-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" \
|
||||||
|
-DBRIDGE_APP_VERSION="${BRIDGE_APP_VERSION}" \
|
||||||
|
-G Ninja \
|
||||||
|
-S . \
|
||||||
|
-B "${BUILD_DIR}"
|
||||||
check_exit "CMake failed"
|
check_exit "CMake failed"
|
||||||
|
|
||||||
cmake --build "${BUILD_DIR}"
|
cmake --build "${BUILD_DIR}"
|
||||||
check_exit "build failed"
|
check_exit "build failed"
|
||||||
|
|
||||||
|
if [ "$1" == "install" ]; then
|
||||||
|
cmake --install "${BUILD_DIR}"
|
||||||
|
check_exit "install failed"
|
||||||
|
fi
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace
|
|||||||
|
|
||||||
QString const launcherFlag = "--launcher"; ///< launcher flag parameter used for bridge.
|
QString const launcherFlag = "--launcher"; ///< launcher flag parameter used for bridge.
|
||||||
QString const bridgeLock = "bridge-gui.lock"; ///< file name used for the lock file.
|
QString const bridgeLock = "bridge-gui.lock"; ///< file name used for the lock file.
|
||||||
QString const exeName = "proton-bridge" + exeSuffix; ///< The bridge executable file name.*
|
QString const exeName = "bridge" + exeSuffix; ///< The bridge executable file name.*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user