-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_windows.ps1
More file actions
47 lines (37 loc) · 2.01 KB
/
build_windows.ps1
File metadata and controls
47 lines (37 loc) · 2.01 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
# PowerShell script for building the RQ Library for Windows
# Stop on first error
$ErrorActionPreference = "Stop"
Write-Host "Building RQ Library for Windows (x86_64 and i686)..."
# Function to ensure a directory exists
function EnsureDirectory {
param (
[string]$Directory
)
if (-not (Test-Path -Path $Directory)) {
New-Item -ItemType Directory -Path $Directory -Force | Out-Null
Write-Host "Created directory: $Directory"
}
}
# Build for x86_64 (64-bit Windows)
Write-Host "Building for x86_64-pc-windows-msvc..."
rustup target add x86_64-pc-windows-msvc
cargo build --target x86_64-pc-windows-msvc --release
# Create the output directory if it doesn't exist
EnsureDirectory -Directory "dist\lib\windows\x64"
# Copy the built library files for x86_64
Write-Host "Copying built files to dist\lib\windows\x64\"
Copy-Item -Path "target\x86_64-pc-windows-msvc\release\rq_library.dll" -Destination "dist\lib\windows\x64\" -Force
Copy-Item -Path "target\x86_64-pc-windows-msvc\release\rq_library.lib" -Destination "dist\lib\windows\x64\" -Force
Copy-Item -Path "target\x86_64-pc-windows-msvc\release\rq_library.dll.lib" -Destination "dist\lib\windows\x64\" -Force -ErrorAction SilentlyContinue
# Build for i686 (32-bit Windows)
Write-Host "Building for i686-pc-windows-msvc..."
rustup target add i686-pc-windows-msvc
cargo build --target i686-pc-windows-msvc --release
# Create the output directory if it doesn't exist
EnsureDirectory -Directory "dist\lib\windows\x86"
# Copy the built library files for i686
Write-Host "Copying built files to dist\lib\windows\x86\"
Copy-Item -Path "target\i686-pc-windows-msvc\release\rq_library.dll" -Destination "dist\lib\windows\x86\" -Force
Copy-Item -Path "target\i686-pc-windows-msvc\release\rq_library.lib" -Destination "dist\lib\windows\x86\" -Force
Copy-Item -Path "target\i686-pc-windows-msvc\release\rq_library.dll.lib" -Destination "dist\lib\windows\x86\" -Force -ErrorAction SilentlyContinue
Write-Host "Windows build completed. Output files in dist\lib\windows\"