Skip to content

Commit dcc52b5

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 dcc52b5

File tree

3 files changed

+134
-40
lines changed

3 files changed

+134
-40
lines changed

README.md

Lines changed: 75 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -259,68 +259,78 @@ You can examine the files in the `.github/workflows/` directory to see how conti
259259

260260
### Ubuntu Linux
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
266+
267+
### Building and testing in Linux
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"}'
266274

267275
### Windows
268276

269-
- Download Visual Studio 2019 community installer from https://visualstudio.microsoft.com/ and install _Desktop C++ Development_
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 component
279+
- _NET desktop development_
280+
- _Desktop development with C++_
281+
282+
- After install has finished, open Developer Command Prompt for VS 2022 and run commands given below
283+
- 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)
284+
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
270285
- Install WIX toolset
271286

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
287+
dotnet tool install --global wix --version 6.0.1
288+
wix extension -g add WixToolset.UI.wixext/6.0.1
289+
wix extension -g add WixToolset.Util.wixext/6.0.1
290+
wix extension -g add WixToolset.BootstrapperApplications.wixext/6.0.1
276291

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

281295
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
282296
cd C:\vcpkg
283297
.\bootstrap-vcpkg.bat
284298
.\vcpkg integrate install
285299

286-
- Install _Google Test_ and _OpenSSL_ with _vcpkg_:
287-
288-
.\vcpkg install --recurse --triplet x64-windows --clean-after-build gtest openssl
300+
- Install _Google Test_ and _OpenSSL_ with _vcpkg_.
301+
Create a file \vcpkg\vpkg.json with content
302+
```
303+
{
304+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
305+
"builtin-baseline": "a62ce77d56ee07513b4b67de1ec2daeaebfae51a",
306+
"dependencies": [
307+
"gtest",
308+
"openssl"
309+
],
310+
"overrides": [
311+
{
312+
"name": "openssl",
313+
"version": "1.1.1n"
314+
}
315+
]
316+
}
317+
```
318+
And run:
319+
.\vcpkg install --recurse --triplet x64-windows --clean-after-build --vcpkg-root \vcpkg
289320

290321
- 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"}'
322+
You are required to create an account or log in with existing one.
323+
324+
Choose _Custom installation > Qt 6.9.3 > MSVC 2022 64-bit_.
325+
Do not add cmake or ninja or any other component as they are already installed with Visual Studio 2022
316326

317327
### Building and testing in Windows
318328

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

321331
- Set the _Qt_ installation directory variable:
322332

323-
$QT_ROOT = "C:\Qt\6.2.4\msvc2019_64"
333+
$QT_ROOT = "C:\Qt\6.9.3\msvc2022_64"
324334

325335
- Set the _vcpkg_ installation directory variable:
326336

@@ -351,6 +361,33 @@ Optionally, WIX Toolset v3 is required for the installer, and the WIX environmen
351361

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

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

356393
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)