-
Notifications
You must be signed in to change notification settings - Fork 31
build: add build instructions for Linux, MacOS and Windows #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
svenzik
wants to merge
1
commit into
main
Choose a base branch
from
WE2-1045
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,104 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Builds the web-eid-app project in Windows | ||
|
|
||
| .PARAMETER clean | ||
| Clean build directory before building. | ||
|
|
||
| .PARAMETER cmake | ||
| Path to cmake.exe. Default C:\Program Files\CMake\bin\cmake.exe or auto-detected to use the one installed by Microsoft Visual Studio. | ||
|
|
||
| .PARAMETER vcpkgroot | ||
| Path to vcpkg installation directory. Default C:\vcpkg. | ||
|
|
||
| .PARAMETER qtdir | ||
| Path to Qt installation directory. Default C:\Qt\6.10.0\msvc2022_64. | ||
|
|
||
| .PARAMETER buildtype | ||
| Sets CMAKE_BUILD_TYPE. Default RelWithDebInfo. | ||
|
|
||
| .PARAMETER arch | ||
| Default x64. | ||
|
|
||
| .PARAMETER fullbuild | ||
| Also run target installer, bundle and tests. | ||
|
|
||
| .OUTPUTS | ||
| Built artifacts will be in dir build/windows. | ||
|
|
||
| .EXAMPLE | ||
| .\build.ps1 -clean | ||
|
|
||
| .EXAMPLE | ||
| .\build.ps1 -clean -qtdir "C:\Qt\6.11.0\msvc2022_64" | ||
| Use Qt version other than default. | ||
| #> | ||
| param( | ||
| [switch]$clean, | ||
| [string]$cmake = "C:\Program Files\CMake\bin\cmake.exe", | ||
| [string]$vcpkgroot = "C:\vcpkg", | ||
| [string]$qtdir = "C:\Qt\6.10.0\msvc2022_64", | ||
| [string]$buildtype = "RelWithDebInfo", | ||
| [string]$arch = "x64" | ||
| [switch]$fullbuild | ||
| ) | ||
|
|
||
| & $cmake -S . -B build\windows -A $arch -DCMAKE_BUILD_TYPE=$buildtype "-DCMAKE_PREFIX_PATH=$qtdir" "-DCMAKE_TOOLCHAIN_FILE=$vcpkgroot\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_MANIFEST_DIR=lib/libelectronic-id" | ||
| & $cmake --build build\windows --config $buildtype | ||
| $vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath | ||
|
|
||
| # fix error WIX0150: Undefined preprocessor variable '$(env.VisualStudioVersion)' etc. | ||
| if (-not $env:VisualStudioVersion) { | ||
| $vsDevCmd = "$vsPath\Common7\Tools\VsDevCmd.bat" | ||
| cmd /c "`"$vsDevCmd`" -arch=$arch && set" | ForEach-Object { | ||
| if ($_ -match "^([^=]+)=(.*)$") { | ||
| [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (-not (Test-Path $cmake)) { | ||
| $vsCmake = "$vsPath\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" | ||
| if (Test-Path $vsCmake) { | ||
| $cmake = $vsCmake | ||
| Write-Host "Found cmake at path $cmake" | ||
| } else { | ||
| Write-Error "Visual Studio CMake component not found, please provide -cmake parameter with full path to cmake.exe" | ||
| } | ||
| } | ||
|
|
||
| if (-not (Test-Path $qtdir)) { | ||
| Write-Error "Qt installation directory $qtdir not found, use parameter -qtdir <path>" | ||
| exit 1 | ||
| } | ||
|
|
||
| if (-not (Get-Command wix -ErrorAction SilentlyContinue)) { | ||
| Write-Host "Installing WiX Toolset..." | ||
|
|
||
| dotnet tool install --global wix --version 6.0.2 | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "Failed to install WiX Toolset" | ||
| exit $LASTEXITCODE | ||
| } | ||
|
|
||
| wix extension -g add WixToolset.UI.wixext/6.0.2 | ||
| wix extension -g add WixToolset.Util.wixext/6.0.2 | ||
| wix extension -g add WixToolset.BootstrapperApplications.wixext/6.0.2 | ||
| } | ||
|
|
||
| if ($clean) { | ||
| & $cmake --build build --target clean | ||
| } | ||
|
|
||
| & $cmake -S . -B build\windows -A $arch -DCMAKE_BUILD_TYPE=$buildtype "-DCMAKE_PREFIX_PATH=$qtdir" "-DCMAKE_TOOLCHAIN_FILE=$vcpkgroot\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_MANIFEST_DIR=lib/libelectronic-id" | ||
| & $cmake --build build\windows --config $buildtype | ||
|
|
||
| if ($fullbuild) { | ||
| & $cmake --build build\windows --config $buildtype --target installer | ||
| & $cmake --build build\windows --config $buildtype --target bundle | ||
|
|
||
| if (-not (Get-Command qmake -ErrorAction SilentlyContinue)) { | ||
| $env:PATH += ";$qtdir\bin" | ||
| } | ||
| & ctest -V -C $buildtype --test-dir build/windows | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!zsh | ||
|
|
||
| set -e | ||
| set -u | ||
|
|
||
| BUILD_TYPE=RelWithDebInfo | ||
| BUILD_DIR=build | ||
| BUILD_NUMBER=1234 | ||
| OPENSSL_ROOT_DIR=$(brew --prefix openssl@3) | ||
| GTest_ROOT=$(brew --prefix gtest) | ||
| CMAKE_BUILD_PARALLEL_LEVEL=3 | ||
| QT_QPA_PLATFORM=offscreen | ||
| MACOSX_DEPLOYMENT_TARGET=12.0 | ||
|
|
||
| # 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 | ||
| 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 | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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