-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_rust.ps1
35 lines (26 loc) · 868 Bytes
/
build_rust.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Push-Location
# Build the library for the current platform
Set-Location -Path "rust"
cargo build --release
if ($LASTEXITCODE -ne 0) {
Pop-Location
exit $LASTEXITCODE
}
$sourceFile = "target/release/hf_tokenizers.dll"
$arch = switch ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) {
"X64" { "x64" }
"X86" { "x86" }
"Arm" { "arm" }
"Arm64" { "arm64" }
Default { "unknown" }
}
$os = switch -Wildcard ([System.Runtime.InteropServices.RuntimeInformation]::OSDescription) {
"*Windows*" { "win"; break }
"*Linux*" { "linux"; break }
Default { "unknown" }
}
$destinationPath = "../nuget/$os-$arch/";
Copy-Item -Path $sourceFile -Destination $destinationPath -Force
$destinationPath = "../dotnet/Tokenizers.DotNet.Test/"
Copy-Item -Path $sourceFile -Destination $destinationPath -Force
Pop-Location