feat(rembg): add RemoveBG Studio - native background removal app
C++ WebView2 host app driving a Python/rembg engine as a JSON-stdio sidecar, with live before/after preview for images and video frames. Also includes the original CLI (removebg.py) built on the same core/ engine. The WebView2 SDK is fetched on demand via native/third_party/fetch-webview2.ps1 (wired into the Makefile) rather than vendored, since it's ~15MB of prebuilt/generated Microsoft SDK content. A Makefile provides make sync/build/run/clean as the standard entry points.
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Fetches the Microsoft WebView2 SDK (headers + x64 loader libs) into
|
||||
native/third_party/webview2/, without needing NuGet or vcpkg installed.
|
||||
|
||||
The SDK is downloaded directly from nuget.org (same package vcpkg/NuGet
|
||||
would fetch), unpacked, and only the pieces the CMake build needs are
|
||||
copied out. Safe to re-run — skips work if already present unless -Force
|
||||
is passed.
|
||||
#>
|
||||
param(
|
||||
[string]$Version = "1.0.4078.44",
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$root = Join-Path $PSScriptRoot "webview2"
|
||||
$includeDir = Join-Path $root "include"
|
||||
$libDir = Join-Path $root "lib\x64"
|
||||
$marker = Join-Path $includeDir "WebView2.h"
|
||||
|
||||
if ((Test-Path $marker) -and -not $Force) {
|
||||
Write-Host "WebView2 SDK already present at $root (use -Force to re-fetch)."
|
||||
exit 0
|
||||
}
|
||||
|
||||
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) ("webview2-fetch-" + [guid]::NewGuid())
|
||||
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
||||
$zipPath = Join-Path $tempDir "webview2.zip"
|
||||
$extractPath = Join-Path $tempDir "pkg"
|
||||
|
||||
try {
|
||||
$url = "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/$Version"
|
||||
Write-Host "Downloading Microsoft.Web.WebView2 $Version from nuget.org..."
|
||||
Invoke-WebRequest -Uri $url -OutFile $zipPath -UseBasicParsing
|
||||
|
||||
Write-Host "Extracting..."
|
||||
Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force
|
||||
|
||||
New-Item -ItemType Directory -Path $includeDir -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path $libDir -Force | Out-Null
|
||||
|
||||
Copy-Item (Join-Path $extractPath "build\native\include\*.h") $includeDir -Force
|
||||
Copy-Item (Join-Path $extractPath "build\native\x64\WebView2LoaderStatic.lib") $libDir -Force
|
||||
Copy-Item (Join-Path $extractPath "build\native\x64\WebView2Loader.dll.lib") $libDir -Force
|
||||
Copy-Item (Join-Path $extractPath "build\native\x64\WebView2Loader.dll") $libDir -Force
|
||||
|
||||
Write-Host "WebView2 SDK $Version installed to $root"
|
||||
}
|
||||
finally {
|
||||
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
|
||||
}
|
||||
+24765
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user