$ErrorActionPreference='Stop' $root=Split-Path $PSScriptRoot -Parent $build=Join-Path $root 'build/windows' $install=Join-Path $root 'build/install' $vswhere=Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio/Installer/vswhere.exe' $vs=(& $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | Select-Object -First 1).Trim() $vcvars=Join-Path $vs 'VC/Auxiliary/Build/vcvars64.bat' & cmd /d /c "call `"$vcvars`" && cmake -S `"$root`" -B `"$build`" -G Ninja -DYOLO_RUNTIME_BUILD_RKNN_BACKENDS=OFF -DCMAKE_BUILD_TYPE=Release && cmake --build `"$build`" -j4 && ctest --test-dir `"$build`" --output-on-failure && cmake --install `"$build`" --prefix `"$install`"" if($LASTEXITCODE -ne 0){throw 'Public Runtime build/test/install failed'} & python (Join-Path $root 'tests/manifest_test.py') $install if($LASTEXITCODE -ne 0){throw 'Manifest negative checks failed'} $consumer=Join-Path $root 'build/consumer-source' New-Item -ItemType Directory -Force $consumer | Out-Null @' cmake_minimum_required(VERSION 3.24) project(RuntimeConsumer C) find_package(YoloRuntime 5 CONFIG REQUIRED) add_executable(consumer main.c) target_link_libraries(consumer PRIVATE YoloRuntime::Runtime) '@ | Set-Content (Join-Path $consumer 'CMakeLists.txt') -Encoding ASCII '#include ' + "`n" + 'int main(void){unsigned char rgb[3]={1,2,3}; if(yolo_masks_compose_rgb_ids(0,0,1,1,rgb,3,3,0)!=YOLO_STATUS_OK || rgb[0] || rgb[1] || rgb[2]) return 2; return yolo_runtime_get_abi_version()==5 ? 0 : 1;}' | Set-Content (Join-Path $consumer 'main.c') -Encoding ASCII $consumerBuild=Join-Path $root 'build/consumer' & cmd /d /c "call `"$vcvars`" && cmake -S `"$consumer`" -B `"$consumerBuild`" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=`"$install`" && cmake --build `"$consumerBuild`"" if($LASTEXITCODE -ne 0){throw 'Installed package consumer build failed'} $env:PATH=(Join-Path $install 'lib')+';'+$env:PATH & (Join-Path $consumerBuild 'consumer.exe') if($LASTEXITCODE -ne 0){throw 'Installed package consumer failed'} Write-Output 'YOLO_RUNTIME_PUBLIC_VERIFY_OK'