1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-22 20:17:46 +00:00
novus/scripts/windows-setup.ps1

51 lines
1.7 KiB
PowerShell
Raw Normal View History

2024-04-25 17:18:20 -04:00
# SPDX-FileCopyrightText: 2024 NotNite <hi@notnite.com>
# SPDX-License-Identifier: CC0-1.0
2024-04-25 14:03:04 -04:00
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
$LocalDir = "./local"
$BuildDir = "$LocalDir/build"
$PrefixDir = (Get-Location).Path + "/prefix"
2024-04-25 17:58:49 -04:00
$NumCores = [Environment]::ProcessorCount
function Configure($Name, $ExtraArgs = "") {
$Command = "cmake -B $BuildDir-$Name -DCMAKE_PREFIX_PATH=$PrefixDir -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -DCMAKE_BUILD_TYPE=Debug -S $LocalDir/$Name -DCMAKE_INSTALL_PREFIX=$PrefixDir $ExtraArgs"
Write-Output "Running $Command"
Invoke-Expression $Command
2024-04-25 14:03:04 -04:00
if ($LASTEXITCODE -ne 0) {
throw "Failed to configure $Name"
}
}
function Clone($Name, $Url) {
if (Test-Path "$LocalDir/$Name") {
Write-Information "Skipping clone of $Name because it's source directory already exists"
} else {
git clone --depth=1 $Url "$LocalDir/$Name"
if ($LASTEXITCODE -ne 0) {
throw "Failed to clone $Name from $Url"
}
}
}
2024-04-25 17:30:25 -04:00
function CheckCompileResult($Name) {
if ($LASTEXITCODE -ne 0) {
throw "Failed to build $Name!"
}
}
2024-04-25 14:03:04 -04:00
if (!(Test-Path $LocalDir)) {
New-Item -ItemType Directory -Path $LocalDir
}
2024-04-26 16:24:56 -04:00
# Build breeze icons
Clone "breeze-icons" "https://invent.kde.org/frameworks/breeze-icons.git"
Configure "breeze-icons" "-DICONS_LIBRARY=ON -DSKIP_INSTALL_ICONS=ON"
# Building it twice is intentional, the first time will always fail
cmake --build "$BuildDir-breeze-icons" --config Debug --target install --parallel $NumCores
cmake --build "$BuildDir-breeze-icons" --config Debug --target install --parallel $NumCores
CheckCompileResult "breeze-icons"