2019-04-04 12:10:23 +02:00
|
|
|
Set-PsDebug -Trace 1
|
|
|
|
|
2018-08-02 14:42:14 +02:00
|
|
|
if (-not (Test-Path env:ICINGA2_BUILDPATH)) {
|
|
|
|
$env:ICINGA2_BUILDPATH = '.\build'
|
2018-02-02 17:19:14 +01:00
|
|
|
}
|
2018-08-02 14:42:14 +02:00
|
|
|
|
2018-12-18 12:08:41 +01:00
|
|
|
if (-not (Test-Path env:CMAKE_BUILD_TYPE)) {
|
|
|
|
$env:CMAKE_BUILD_TYPE = 'RelWithDebInfo'
|
|
|
|
}
|
2018-08-02 14:42:14 +02:00
|
|
|
if (-not (Test-Path "$env:ICINGA2_BUILDPATH")) {
|
|
|
|
mkdir "$env:ICINGA2_BUILDPATH" | out-null
|
|
|
|
}
|
2018-02-02 17:19:14 +01:00
|
|
|
if (-not (Test-Path env:CMAKE_PATH)) {
|
|
|
|
$env:CMAKE_PATH = 'C:\Program Files\CMake\bin'
|
|
|
|
}
|
|
|
|
if (-not ($env:PATH -contains $env:CMAKE_PATH)) {
|
|
|
|
$env:PATH = $env:CMAKE_PATH + ';' + $env:PATH
|
|
|
|
}
|
|
|
|
if (-not (Test-Path env:CMAKE_GENERATOR)) {
|
2020-10-20 16:39:19 +02:00
|
|
|
$env:CMAKE_GENERATOR = 'Visual Studio 16 2019'
|
|
|
|
}
|
2021-07-07 13:19:37 +02:00
|
|
|
if (-not (Test-Path env:BITS)) {
|
|
|
|
$env:BITS = 64
|
|
|
|
}
|
2020-10-20 16:39:19 +02:00
|
|
|
if (-not (Test-Path env:CMAKE_GENERATOR_PLATFORM)) {
|
2021-07-07 13:19:37 +02:00
|
|
|
if ($env:BITS -eq 32) {
|
|
|
|
$env:CMAKE_GENERATOR_PLATFORM = 'Win32'
|
|
|
|
} else {
|
|
|
|
$env:CMAKE_GENERATOR_PLATFORM = 'x64'
|
|
|
|
}
|
2018-02-02 17:19:14 +01:00
|
|
|
}
|
|
|
|
if (-not (Test-Path env:OPENSSL_ROOT_DIR)) {
|
2023-02-14 11:40:44 +01:00
|
|
|
$env:OPENSSL_ROOT_DIR = "c:\local\OpenSSL_1_1_1t-Win${env:BITS}"
|
2018-02-02 17:19:14 +01:00
|
|
|
}
|
|
|
|
if (-not (Test-Path env:BOOST_ROOT)) {
|
2023-02-14 14:36:16 +01:00
|
|
|
$env:BOOST_ROOT = "c:\local\boost_1_81_0-Win${env:BITS}"
|
2018-02-02 17:19:14 +01:00
|
|
|
}
|
|
|
|
if (-not (Test-Path env:BOOST_LIBRARYDIR)) {
|
2023-02-14 14:36:16 +01:00
|
|
|
$env:BOOST_LIBRARYDIR = "c:\local\boost_1_81_0-Win${env:BITS}\lib${env:BITS}-msvc-14.2"
|
2018-02-02 17:19:14 +01:00
|
|
|
}
|
|
|
|
if (-not (Test-Path env:FLEX_BINARY)) {
|
|
|
|
$env:FLEX_BINARY = 'C:\ProgramData\chocolatey\bin\win_flex.exe'
|
|
|
|
}
|
|
|
|
if (-not (Test-Path env:BISON_BINARY)) {
|
|
|
|
$env:BISON_BINARY = 'C:\ProgramData\chocolatey\bin\win_bison.exe'
|
|
|
|
}
|
|
|
|
|
2018-08-02 14:42:14 +02:00
|
|
|
$sourcePath = Get-Location
|
2018-02-02 17:19:14 +01:00
|
|
|
|
2018-08-02 14:42:14 +02:00
|
|
|
cd "$env:ICINGA2_BUILDPATH"
|
|
|
|
|
|
|
|
#-DCMAKE_INSTALL_PREFIX="C:\Program Files\Icinga2" `
|
|
|
|
|
2018-12-18 11:52:06 +01:00
|
|
|
# Invalidate cache in case something in the build environment changed
|
|
|
|
if (Test-Path CMakeCache.txt) {
|
|
|
|
Remove-Item -Force CMakeCache.txt | Out-Null
|
|
|
|
}
|
|
|
|
|
2018-08-02 14:42:14 +02:00
|
|
|
& cmake.exe "$sourcePath" `
|
2018-12-18 12:08:41 +01:00
|
|
|
-DCMAKE_BUILD_TYPE="$env:CMAKE_BUILD_TYPE" `
|
2020-10-20 16:39:19 +02:00
|
|
|
-G "$env:CMAKE_GENERATOR" -A "$env:CMAKE_GENERATOR_PLATFORM" -DCPACK_GENERATOR=WIX `
|
2018-02-02 17:19:14 +01:00
|
|
|
-DOPENSSL_ROOT_DIR="$env:OPENSSL_ROOT_DIR" `
|
|
|
|
-DBOOST_LIBRARYDIR="$env:BOOST_LIBRARYDIR" `
|
2019-04-04 12:10:23 +02:00
|
|
|
-DBOOST_INCLUDEDIR="$env:BOOST_ROOT" `
|
2018-02-02 17:19:14 +01:00
|
|
|
-DFLEX_EXECUTABLE="$env:FLEX_BINARY" `
|
|
|
|
-DBISON_EXECUTABLE="$env:BISON_BINARY"
|
|
|
|
|
2018-08-02 14:42:14 +02:00
|
|
|
cd "$sourcePath"
|
|
|
|
|
2018-02-02 17:19:14 +01:00
|
|
|
if ($lastexitcode -ne 0) {
|
|
|
|
exit $lastexitcode
|
|
|
|
}
|