| 1 | # Builds the Windows artifacts (nodejs binaries). |
| 2 | # Usage: .\ci\build_windows_artifacts_nodejs.ps1 [target] |
| 3 | # Targets supported: |
| 4 | # - x86_64-pc-windows-msvc |
| 5 | # - i686-pc-windows-msvc |
| 6 | |
| 7 | function Prebuild-Rust { |
| 8 | param ( |
| 9 | [string]$target |
| 10 | ) |
| 11 | |
| 12 | # Building here for the sake of easier debugging. |
| 13 | Push-Location -Path "rust/lancedb" |
| 14 | Write-Host "Building rust library for $target" |
| 15 | $env:RUST_BACKTRACE=1 |
| 16 | cargo build --release --target $target |
| 17 | Pop-Location |
| 18 | } |
| 19 | |
| 20 | function Build-NodeBinaries { |
| 21 | param ( |
| 22 | [string]$target |
| 23 | ) |
| 24 | |
| 25 | Push-Location -Path "nodejs" |
| 26 | Write-Host "Building nodejs library for $target" |
| 27 | $env:RUST_TARGET=$target |
| 28 | npm run build-release |
| 29 | Pop-Location |
| 30 | } |
| 31 | |
| 32 | $targets = $args[0] |
| 33 | if (-not $targets) { |
| 34 | $targets = "x86_64-pc-windows-msvc" |
| 35 | } |
| 36 | |
| 37 | Write-Host "Building artifacts for targets: $targets" |
| 38 | foreach ($target in $targets) { |
| 39 | Prebuild-Rust $target |
| 40 | Build-NodeBinaries $target |
| 41 | } |