build: ship prebuilt native_host bridge DLLs so fresh clones skip VST3 SDK requirement

This commit is contained in:
2026-08-11 20:42:45 +07:00
parent 255e8586bc
commit e3c9d6e4ab
5 changed files with 36 additions and 18 deletions
+1
View File
@@ -35,6 +35,7 @@ src-tauri/binaries/
src-tauri/resources/daw_engine/ src-tauri/resources/daw_engine/
src-tauri/resources/native_host/* src-tauri/resources/native_host/*
!src-tauri/resources/native_host/.gitkeep !src-tauri/resources/native_host/.gitkeep
!src-tauri/resources/native_host/*.dll
src-tauri/vc_redist.x64.exe src-tauri/vc_redist.x64.exe
app/storage/plugin_dirs.json app/storage/plugin_dirs.json
app/storage/sf_scan_state.json.bak-root app/storage/sf_scan_state.json.bak-root
+35 -18
View File
@@ -69,28 +69,45 @@ Write-Host "== [4b/6] Native host bridges (CMake/MSVC) + FluidSynth runtime =="
# trong resources/native_host/ de exe tim thay luc runtime (Rust: resource_dir/ # trong resources/native_host/ de exe tim thay luc runtime (Rust: resource_dir/
# native_host; Python: SF_RESOURCE_DIR/native_host). Thieu -> native audio / # native_host; Python: SF_RESOURCE_DIR/native_host). Thieu -> native audio /
# VST GUI khong chay tren may cai sach. # VST GUI khong chay tren may cai sach.
if (-not (Test-Path "native_host\build\CMakeCache.txt")) { #
if (-not $env:VST3_SDK_ROOT) { # Prebuilt: 3 bridge DLL (~175KB) DUOC COMMIT vao src-tauri/resources/native_host/
Write-Host "ERROR: can VST3_SDK_ROOT env (duong dan VST3 SDK) khi chua co native_host\build" -ForegroundColor Red # (.gitignore cho phep *.dll) de nguoi dung clone moi KHONG can VST3 SDK
exit 1 # (Steinberg SDK ban quyen) + khong can MSVC/cmake. Chi build tu source khi
# ca 3 DLL deu thieu (may dev tu build bridge moi).
$bridgeDlls = @("sf_host_bridge.dll","vst2_host_bridge.dll","vst3_host_bridge.dll")
$havePrebuilt = $true
foreach ($dllName in $bridgeDlls) {
if (-not (Test-Path "src-tauri\resources\native_host\$dllName")) { $havePrebuilt = $false }
}
if ($havePrebuilt) {
Write-Host "Dung prebuilt bridge DLL (resources/native_host) - skip cmake build, khong can VST3 SDK."
} else {
if (-not (Test-Path "native_host\build\CMakeCache.txt")) {
if (-not $env:VST3_SDK_ROOT) {
Write-Host "ERROR: thieu prebuilt bridge DLL + khong co native_host\build + VST3_SDK_ROOT chua set." -ForegroundColor Red
Write-Host " Cach 1 (khuyen nghi): git pull lai de co src-tauri/resources/native_host/*.dll (prebuilt)." -ForegroundColor Yellow
Write-Host " Cach 2 (dev): set env VST3_SDK_ROOT tro den VST3 SDK roi build lai native_host." -ForegroundColor Yellow
exit 1
}
& cmake -S native_host -B native_host\build -A x64 -DVST3_SDK_ROOT="$env:VST3_SDK_ROOT"
if ($LASTEXITCODE -ne 0) { Write-Host "ERROR: cmake configure native_host that bai" -ForegroundColor Red; exit 1 }
} }
& cmake -S native_host -B native_host\build -A x64 -DVST3_SDK_ROOT="$env:VST3_SDK_ROOT" & cmake --build native_host\build --config Release
if ($LASTEXITCODE -ne 0) { Write-Host "ERROR: cmake configure native_host that bai" -ForegroundColor Red; exit 1 } if ($LASTEXITCODE -ne 0) { Write-Host "ERROR: cmake build native_host that bai" -ForegroundColor Red; exit 1 }
} Copy-Item "native_host\build\Release\vst2_host_bridge.dll","native_host\build\Release\vst3_host_bridge.dll","native_host\build\Release\sf_host_bridge.dll" "src-tauri\resources\native_host\"
& cmake --build native_host\build --config Release
if ($LASTEXITCODE -ne 0) { Write-Host "ERROR: cmake build native_host that bai" -ForegroundColor Red; exit 1 }
if (-not (Test-Path "native_host\fluidsynth_runtime\libfluidsynth-3.dll")) {
python native_host\scripts\dl_fluidsynth_runtime.py
if ($LASTEXITCODE -ne 0) { Write-Host "ERROR: dl_fluidsynth_runtime that bai" -ForegroundColor Red; exit 1 }
} }
if (Test-Path "src-tauri\resources\native_host") { # fluidsynth_runtime (14.8MB, gitignore) - khong commit; tu dong tai neu thieu.
Remove-Item -Recurse -Force "src-tauri\resources\native_host" if (-not (Test-Path "src-tauri\resources\native_host\fluidsynth_runtime\libfluidsynth-3.dll")) {
if (-not (Test-Path "native_host\fluidsynth_runtime\libfluidsynth-3.dll")) {
python native_host\scripts\dl_fluidsynth_runtime.py
if ($LASTEXITCODE -ne 0) { Write-Host "ERROR: dl_fluidsynth_runtime that bai" -ForegroundColor Red; exit 1 }
}
New-Item -ItemType Directory -Force "src-tauri\resources\native_host\fluidsynth_runtime" | Out-Null
Copy-Item "native_host\fluidsynth_runtime\*" "src-tauri\resources\native_host\fluidsynth_runtime\" -Recurse -Force
} else {
Write-Host "Da co fluidsynth_runtime trong resources/native_host."
} }
New-Item -ItemType Directory -Force "src-tauri\resources\native_host" | Out-Null
Copy-Item "native_host\build\Release\vst2_host_bridge.dll","native_host\build\Release\vst3_host_bridge.dll","native_host\build\Release\sf_host_bridge.dll" "src-tauri\resources\native_host\"
Copy-Item "native_host\fluidsynth_runtime" "src-tauri\resources\native_host\fluidsynth_runtime" -Recurse -Force
Write-Host "== [5/6] VC++ Redistributable cho hooks.nsh ==" Write-Host "== [5/6] VC++ Redistributable cho hooks.nsh =="
if (-not (Test-Path src-tauri\vc_redist.x64.exe)) { if (-not (Test-Path src-tauri\vc_redist.x64.exe)) {
Binary file not shown.
Binary file not shown.
Binary file not shown.