19 lines
1.0 KiB
PowerShell
19 lines
1.0 KiB
PowerShell
# Copyright 2026 Sverse contributors. Licensed under the Apache License, Version 2.0.
|
|
[CmdletBinding()]
|
|
param([string]$Generator = 'Visual Studio 17 2022')
|
|
$ErrorActionPreference = 'Stop'
|
|
$spatialRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
|
$spatialRuntime = Join-Path $spatialRoot '.spatial-runtime'
|
|
$spatialSource = Join-Path $spatialRuntime 'opus-src'
|
|
$spatialBuild = Join-Path $spatialRuntime 'opus-build'
|
|
New-Item -ItemType Directory -Path $spatialRuntime -Force | Out-Null
|
|
if (!(Test-Path -LiteralPath $spatialSource)) {
|
|
& git clone --depth 1 --branch v1.5.2 https://github.com/xiph/opus.git $spatialSource
|
|
if ($LASTEXITCODE -ne 0) { throw 'Opus clone failed' }
|
|
}
|
|
& cmake -S $spatialSource -B $spatialBuild -G $Generator -A x64 -DBUILD_SHARED_LIBS=ON -DOPUS_BUILD_TESTING=OFF -DOPUS_BUILD_PROGRAMS=OFF
|
|
if ($LASTEXITCODE -ne 0) { throw 'Opus configure failed' }
|
|
& cmake --build $spatialBuild --config Release --parallel
|
|
if ($LASTEXITCODE -ne 0) { throw 'Opus build failed' }
|
|
Write-Host "Library: $(Join-Path $spatialBuild 'Release\opus.dll')"
|