Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 76 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,70 +257,83 @@ The extension's native app in `main.mm` is a thin adapter layer on top of the Qt

You can examine the files in the `.github/workflows/` directory to see how continuous integration build environment has been set up for different operating systems.

### Ubuntu Linux
### Ubuntu Linux setup

Run all commands starting from `RUN apt-get update` from the following
`Dockerfile`:
Install dependecies

https://github.com/mrts/docker-qt-cmake-gtest-valgrind-ubuntu/blob/master/Dockerfile
apt update
apt install --no-install-recommends -y lsb-release build-essential devscripts debhelper pkg-config cmake libpcsclite-dev libssl-dev libgtest-dev libgl-dev libqt6svg6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools

### Windows
### Linux Building and testing

git clone --recurse-submodules git@github.com:web-eid/web-eid-app.git
cd web-eid-app
./build.sh
./test.sh
./build/src/app/web-eid -c get-signing-certificate '{"origin":"https://ria.ee"}'

### Windows setup

- Download Visual Studio 2022 community installer from https://visualstudio.microsoft.com/ install _Visual Studio_
with description "The most comprehensive IDE for .NET and C++ developers on Windows...". During installation choose components:

- NET desktop development
- Desktop development with C++

- After install has finished, open Developer Command Prompt for VS 2022 and run commands given below
- If Nuget does not contain api.nuget.org as source, please add (https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-add-source#examples)

dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

- Download Visual Studio 2019 community installer from https://visualstudio.microsoft.com/ and install _Desktop C++ Development_
- Install WIX toolset

dotnet tool install --global wix --version 5.0.0
wix extension -g add WixToolset.UI.wixext/5.0.0
wix extension -g add WixToolset.Util.wixext/5.0.0
wix extension -g add WixToolset.Bal.wixext/5.0.0
dotnet tool install --global wix --version 6.0.1
wix extension -g add WixToolset.UI.wixext/6.0.1
wix extension -g add WixToolset.Util.wixext/6.0.1
wix extension -g add WixToolset.BootstrapperApplications.wixext/6.0.1

- Download and install Git for Windows from https://git-scm.com/download/win
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think git is also installed by visual studio

- Download and install CMake from https://cmake.org/download/
- Install _vcpkg_ by running the following commands in Powershell:

git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
cd C:\vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate install

- Install _Google Test_ and _OpenSSL_ with _vcpkg_:

.\vcpkg install --recurse --triplet x64-windows --clean-after-build gtest openssl

- Install _Qt_ with the official [_Qt Online Installer_](https://www.qt.io/download-qt-installer),
choose _Custom installation > Qt 6.6.3 > MSVC 2019 64-bit_.

### macOS

- Install _Homebrew_ if not already installed:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

- Install _CMake_, _Google Test_, _OpenSSL_ and _Qt_ with _Homebrew_:

brew install cmake web-eid/gtest/gtest openssl qt@6 node

- Create symlink to _OpenSSL_ location and setup environment variables required
by _CMake_:

export OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1
export QT_DIR=/usr/local/opt/qt6/lib/cmake/Qt6

## Building and testing

git clone --recurse-submodules git@github.com:web-eid/web-eid-app.git
cd web-eid-app
./build.sh
./test.sh
./build/src/app/web-eid -c get-signing-certificate '{"origin":"https://ria.ee"}'

### Building and testing in Windows
- Install _Google Test_ and _OpenSSL_ with _vcpkg_. In order to install openssl version 1.* create a file C:\vcpkg\vpkg.json with content

{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"builtin-baseline": "a62ce77d56ee07513b4b67de1ec2daeaebfae51a",
"dependencies": [
"gtest",
"openssl"
],
"overrides": [
{
"name": "openssl",
"version": "1.1.1n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenSSL 3.0 is minimum supported

}
]
}

- Install packages:

.\vcpkg install --recurse --triplet x64-windows --clean-after-build --vcpkg-root C:\vcpkg

- Install _Qt_ with the official [_Qt Online Installer_](https://www.qt.io/download-qt-installer).
Installer requires you to create an account or log in with existing one.

Choose _Custom installation > Qt 6.9.3 > MSVC 2022 64-bit_.
Do not add cmake or ninja or any other component as they are already installed with Visual Studio 2022.

### Windows building and testing

Use _Powershell_ to run the following commands to build the project.

- Set the _Qt_ installation directory variable:

$QT_ROOT = "C:\Qt\6.2.4\msvc2019_64"
$QT_ROOT = "C:\Qt\6.9.3\msvc2022_64"

- Set the _vcpkg_ installation directory variable:

Expand Down Expand Up @@ -351,6 +364,25 @@ Optionally, WIX Toolset v3 is required for the installer, and the WIX environmen

ctest -V -C ${BUILD_TYPE} --test-dir build

### macOS setup

- Install _Homebrew_ if not already installed:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

- Install _CMake_, _Google Test_, _OpenSSL_ and _Qt_ with _Homebrew_:

brew install cmake gtest openssl@1.1 qt@6 node

### macOS building and testing

git clone --recurse-submodules git@github.com:web-eid/web-eid-app.git
cd web-eid-app
./build.zsh
./test.sh
./build/src/app/web-eid.app/Contents/MacOS/web-eid -c get-signing-certificate '{"origin":"https://ria.ee"}'


## Adding and updating translations

You can use the free [Qt Linguist application](https://doc.qt.io/qt-5/qtlinguist-index.html)
Expand Down
14 changes: 12 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,15 @@
set -e
set -u

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build -S .
cmake --build build # -- VERBOSE=1
export QT_QPA_PLATFORM=offscreen
export DEBIAN_FRONTEND=noninteractive

if [[ ${1:-} == 'clean' ]]; then
echo -n Cleaning...
cmake --build build --target clean
rm -rf build
echo DONE
fi

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build -S .
cmake --build build --config RelWithDebInfo --target installer # -- VERBOSE=1
47 changes: 47 additions & 0 deletions build.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!zsh

set -e
set -u

BUILD_TYPE=RelWithDebInfo
BUILD_DIR=build
BUILD_NUMBER=1234
OPENSSL_ROOT_DIR=$(brew --prefix openssl@1.1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GTest_ROOT=$(brew --prefix gtest)
CMAKE_BUILD_PARALLEL_LEVEL=3
QT_QPA_PLATFORM=offscreen
MACOSX_DEPLOYMENT_TARGET=12.0

- Create symlink to _OpenSSL_ location and setup environment variables required
by _CMake_:

export OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1
export QT_DIR=/usr/local/opt/qt6/lib/cmake/Qt6
export QT_QPA_PLATFORM=offscreen

# For creating installers, you need to use signing certificates issued by Apple
# SIGNCERT=<apple developer certificate name>

if [[ ${1:-} == 'clean' ]]; then
echo -n Cleaning...
cmake --build build --target clean
rm -rf build
echo DONE
fi

if [[ -n "$SIGNCERT" ]]; then
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -B ${BUILD_DIR} -DSIGNCERT="${SIGNCERT}" -S .
else
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -B ${BUILD_DIR} -S .
fi

cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} # -- VERBOSE=1

# Uncomment in case SIGNCERT is set and you want to create installers
# To create web-eid installer for MacOS: build/src/app/web-eid*.dmg
# To create web-eid-webextension installer for firefox and chrome: build/src/app/web-eid*.pkg
# cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} --target installer

# To create web-eid-webextension installer for safari build/src/mac/web-eid-safari_*.pkg
# cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} --target installer-safari

Loading