Skip to content

Commit 1b6e406

Browse files
committed
build: add build instructions for Linux, MacOS and Windows
WE2-1045 Signed-off-by: Sven Mitt <[email protected]>
1 parent 8c78517 commit 1b6e406

File tree

3 files changed

+135
-46
lines changed

3 files changed

+135
-46
lines changed

README.md

Lines changed: 76 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -257,70 +257,83 @@ The extension's native app in `main.mm` is a thin adapter layer on top of the Qt
257257

258258
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.
259259

260-
### Ubuntu Linux
260+
### Ubuntu Linux setup
261261

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

265-
https://github.com/mrts/docker-qt-cmake-gtest-valgrind-ubuntu/blob/master/Dockerfile
264+
apt update
265+
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
266266

267-
### Windows
267+
### Linux Building and testing
268+
269+
git clone --recurse-submodules [email protected]:web-eid/web-eid-app.git
270+
cd web-eid-app
271+
./build.sh
272+
./test.sh
273+
./build/src/app/web-eid -c get-signing-certificate '{"origin":"https://ria.ee"}'
274+
275+
### Windows setup
276+
277+
- Download Visual Studio 2022 community installer from https://visualstudio.microsoft.com/ install _Visual Studio_
278+
with description "The most comprehensive IDE for .NET and C++ developers on Windows...". During installation choose components:
279+
280+
- NET desktop development
281+
- Desktop development with C++
282+
283+
- After install has finished, open Developer Command Prompt for VS 2022 and run commands given below
284+
- 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)
285+
286+
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
268287

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

272-
dotnet tool install --global wix --version 5.0.0
273-
wix extension -g add WixToolset.UI.wixext/5.0.0
274-
wix extension -g add WixToolset.Util.wixext/5.0.0
275-
wix extension -g add WixToolset.Bal.wixext/5.0.0
290+
dotnet tool install --global wix --version 6.0.1
291+
wix extension -g add WixToolset.UI.wixext/6.0.1
292+
wix extension -g add WixToolset.Util.wixext/6.0.1
293+
wix extension -g add WixToolset.BootstrapperApplications.wixext/6.0.1
276294

277295
- Download and install Git for Windows from https://git-scm.com/download/win
278-
- Download and install CMake from https://cmake.org/download/
279296
- Install _vcpkg_ by running the following commands in Powershell:
280297

281298
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
282299
cd C:\vcpkg
283300
.\bootstrap-vcpkg.bat
284301
.\vcpkg integrate install
285302

286-
- Install _Google Test_ and _OpenSSL_ with _vcpkg_:
287-
288-
.\vcpkg install --recurse --triplet x64-windows --clean-after-build gtest openssl
289-
290-
- Install _Qt_ with the official [_Qt Online Installer_](https://www.qt.io/download-qt-installer),
291-
choose _Custom installation > Qt 6.6.3 > MSVC 2019 64-bit_.
292-
293-
### macOS
294-
295-
- Install _Homebrew_ if not already installed:
296-
297-
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
298-
299-
- Install _CMake_, _Google Test_, _OpenSSL_ and _Qt_ with _Homebrew_:
300-
301-
brew install cmake web-eid/gtest/gtest openssl qt@6 node
302-
303-
- Create symlink to _OpenSSL_ location and setup environment variables required
304-
by _CMake_:
305-
306-
export OPENSSL_ROOT_DIR=/usr/local/opt/[email protected]
307-
export QT_DIR=/usr/local/opt/qt6/lib/cmake/Qt6
308-
309-
## Building and testing
310-
311-
git clone --recurse-submodules [email protected]:web-eid/web-eid-app.git
312-
cd web-eid-app
313-
./build.sh
314-
./test.sh
315-
./build/src/app/web-eid -c get-signing-certificate '{"origin":"https://ria.ee"}'
316-
317-
### Building and testing in Windows
303+
- Install _Google Test_ and _OpenSSL_ with _vcpkg_. In order to install openssl version 1.* create a file C:\vcpkg\vpkg.json with content
304+
305+
{
306+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
307+
"builtin-baseline": "a62ce77d56ee07513b4b67de1ec2daeaebfae51a",
308+
"dependencies": [
309+
"gtest",
310+
"openssl"
311+
],
312+
"overrides": [
313+
{
314+
"name": "openssl",
315+
"version": "1.1.1n"
316+
}
317+
]
318+
}
319+
320+
- Install packages:
321+
322+
.\vcpkg install --recurse --triplet x64-windows --clean-after-build --vcpkg-root C:\vcpkg
323+
324+
- Install _Qt_ with the official [_Qt Online Installer_](https://www.qt.io/download-qt-installer).
325+
Installer requires you to create an account or log in with existing one.
326+
327+
Choose _Custom installation > Qt 6.9.3 > MSVC 2022 64-bit_.
328+
Do not add cmake or ninja or any other component as they are already installed with Visual Studio 2022.
329+
330+
### Windows building and testing
318331

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

321334
- Set the _Qt_ installation directory variable:
322335

323-
$QT_ROOT = "C:\Qt\6.2.4\msvc2019_64"
336+
$QT_ROOT = "C:\Qt\6.9.3\msvc2022_64"
324337

325338
- Set the _vcpkg_ installation directory variable:
326339

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

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

367+
### macOS setup
368+
369+
- Install _Homebrew_ if not already installed:
370+
371+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
372+
373+
- Install _CMake_, _Google Test_, _OpenSSL_ and _Qt_ with _Homebrew_:
374+
375+
brew install cmake gtest [email protected] qt@6 node
376+
377+
### macOS building and testing
378+
379+
git clone --recurse-submodules [email protected]:web-eid/web-eid-app.git
380+
cd web-eid-app
381+
./build.zsh
382+
./test.sh
383+
./build/src/app/web-eid.app/Contents/MacOS/web-eid -c get-signing-certificate '{"origin":"https://ria.ee"}'
384+
385+
354386
## Adding and updating translations
355387

356388
You can use the free [Qt Linguist application](https://doc.qt.io/qt-5/qtlinguist-index.html)

build.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,15 @@
33
set -e
44
set -u
55

6-
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build -S .
7-
cmake --build build # -- VERBOSE=1
6+
export QT_QPA_PLATFORM=offscreen
7+
export DEBIAN_FRONTEND=noninteractive
8+
9+
if [[ ${1:-} == 'clean' ]]; then
10+
echo -n Cleaning...
11+
cmake --build build --target clean
12+
rm -rf build
13+
echo DONE
14+
fi
15+
16+
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build -S .
17+
cmake --build build --config RelWithDebInfo --target installer # -- VERBOSE=1

build.zsh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!zsh
2+
3+
set -e
4+
set -u
5+
6+
BUILD_TYPE=RelWithDebInfo
7+
BUILD_DIR=build
8+
BUILD_NUMBER=1234
9+
OPENSSL_ROOT_DIR=$(brew --prefix [email protected])
10+
GTest_ROOT=$(brew --prefix gtest)
11+
CMAKE_BUILD_PARALLEL_LEVEL=3
12+
QT_QPA_PLATFORM=offscreen
13+
MACOSX_DEPLOYMENT_TARGET=12.0
14+
15+
- Create symlink to _OpenSSL_ location and setup environment variables required
16+
by _CMake_:
17+
18+
export OPENSSL_ROOT_DIR=/usr/local/opt/[email protected]
19+
export QT_DIR=/usr/local/opt/qt6/lib/cmake/Qt6
20+
export QT_QPA_PLATFORM=offscreen
21+
22+
# For creating installers, you need to use signing certificates issued by Apple
23+
# SIGNCERT=<apple developer certificate name>
24+
25+
if [[ ${1:-} == 'clean' ]]; then
26+
echo -n Cleaning...
27+
cmake --build build --target clean
28+
rm -rf build
29+
echo DONE
30+
fi
31+
32+
if [[ -n "$SIGNCERT" ]]; then
33+
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -B ${BUILD_DIR} -DSIGNCERT="${SIGNCERT}" -S .
34+
else
35+
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -B ${BUILD_DIR} -S .
36+
fi
37+
38+
cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} # -- VERBOSE=1
39+
40+
# Uncomment in case SIGNCERT is set and you want to create installers
41+
# To create web-eid installer for MacOS: build/src/app/web-eid*.dmg
42+
# To create web-eid-webextension installer for firefox and chrome: build/src/app/web-eid*.pkg
43+
# cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} --target installer
44+
45+
# To create web-eid-webextension installer for safari build/src/mac/web-eid-safari_*.pkg
46+
# cmake --build ${BUILD_DIR} --config ${BUILD_TYPE} --target installer-safari
47+

0 commit comments

Comments
 (0)