From 684ce8b04b6fc156f093dff274de998f0805a825 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 16 Jul 2026 21:20:15 +0100 Subject: [PATCH] Package controllable Muninn encoder --- scripts/build-muninn-video-encoder.ps1 | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/build-muninn-video-encoder.ps1 diff --git a/scripts/build-muninn-video-encoder.ps1 b/scripts/build-muninn-video-encoder.ps1 new file mode 100644 index 0000000..e04da70 --- /dev/null +++ b/scripts/build-muninn-video-encoder.ps1 @@ -0,0 +1,34 @@ +param( + [string] $FfmpegRoot = $env:MUNINN_FFMPEG_ROOT, + [string] $OutputRoot = (Join-Path $PSScriptRoot '..\artifacts\muninn-video-encoder\bundle') +) + +$ErrorActionPreference = 'Stop' +$repoRoot = Split-Path $PSScriptRoot -Parent +$sourceRoot = Join-Path $repoRoot 'native\muninn-video-encoder' + +if ([string]::IsNullOrWhiteSpace($FfmpegRoot)) { + $candidate = 'E:\Projects\Mimir\artifacts\obs-sdk\obs-plugintemplate\.deps\obs-deps-2025-07-11-x64' + if (Test-Path -LiteralPath $candidate) { + $FfmpegRoot = $candidate + } +} +if ([string]::IsNullOrWhiteSpace($FfmpegRoot) -or + -not (Test-Path -LiteralPath (Join-Path $FfmpegRoot 'include\libavcodec\avcodec.h'))) { + throw 'Set -FfmpegRoot or MUNINN_FFMPEG_ROOT to an FFmpeg development root containing include/ and lib/.' +} + +$buildRoot = Join-Path $sourceRoot 'build' +cmake -S $sourceRoot -B $buildRoot "-DFFMPEG_ROOT=$($FfmpegRoot.Replace('\', '/'))" +if ($LASTEXITCODE -ne 0) { throw "CMake configure failed with $LASTEXITCODE" } +cmake --build $buildRoot --config Release +if ($LASTEXITCODE -ne 0) { throw "CMake build failed with $LASTEXITCODE" } + +New-Item -ItemType Directory -Force -Path $OutputRoot | Out-Null +Copy-Item -LiteralPath (Join-Path $buildRoot 'Release\muninn-video-encoder.exe') -Destination $OutputRoot -Force +Get-ChildItem -LiteralPath (Join-Path $FfmpegRoot 'bin') -Filter '*.dll' | + Copy-Item -Destination $OutputRoot -Force + +$exe = Join-Path $OutputRoot 'muninn-video-encoder.exe' +if (-not (Test-Path -LiteralPath $exe)) { throw 'Encoder bundle is missing its executable.' } +Write-Host "Muninn controllable encoder bundle: $OutputRoot"