Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Windows setup script #84

Merged
merged 3 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ jobs:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env

- name: Export Homebrew paths for roc
run: |
brew install z3 zstd
export LIBRARY_PATH="/opt/homebrew/lib:$LIBRARY_PATH"

- name: Install ROC
run: |
# Install ROC
Expand Down Expand Up @@ -100,15 +105,21 @@ jobs:

- name: Build the basic-shapes example
run: |
# TODO restore --optimize flag
# .\windows\bin\roc.exe build --no-link --optimize --output=app.obj .\examples\basic-shapes.roc
.\windows\bin\roc.exe build --no-link --optimize --output=app.obj .\examples\basic-shapes.roc
cargo build

- name: Build the 2d_camera example
run: |
.\windows\bin\roc.exe build --no-link --optimize --output=app.obj .\examples\2d_camera.roc
# TODO restore --optimize flag
# .\windows\bin\roc.exe build --no-link --optimize --output=app.obj .\examples\2d_camera.roc
.\windows\bin\roc.exe build --no-link --output=app.obj .\examples\2d_camera.roc
cargo build

- name: Build the pong example
run: |
.\windows\bin\roc.exe build --no-link --optimize --output=app.obj .\examples\pong.roc
# TODO restore --optimize flag
# .\windows\bin\roc.exe build --no-link --optimize --output=app.obj .\examples\pong.roc
.\windows\bin\roc.exe build --no-link --output=app.obj .\examples\pong.roc
cargo build
57 changes: 48 additions & 9 deletions windows/setup.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
$url = "https://github.com/lukewilliamboswell/roc/releases/download/windows-20241108/roc.exe"
$binDir = "$PSScriptRoot\bin\"
$path = "$binDir\roc.exe"
# Configuration
$url = "https://github.com/lukewilliamboswell/roc/releases/download/windows-20241220/roc-windows-x84_64-unnoficial-1bae24b.7z"
$binDir = "$PSScriptRoot\bin"
$tempDir = "$PSScriptRoot\temp"
$archivePath = "$tempDir\roc.7z"
$finalPath = "$binDir\roc.exe"

# download roc to /windows/bin
if (!(Test-Path $path)) {
New-Item -ItemType Directory -Force -Path $binDir
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $path)
}
# Create necessary directories
New-Item -ItemType Directory -Force -Path $binDir
New-Item -ItemType Directory -Force -Path $tempDir

# Only download and extract if the final executable doesn't exist
if (!(Test-Path $finalPath)) {
Write-Host "Downloading Roc archive..."

# Download the archive
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $archivePath)

# Check if 7-Zip is installed
$7zipPath = "$env:ProgramFiles\7-Zip\7z.exe"

if (!(Test-Path $7zipPath)) {
Write-Host "7-Zip is required but not found. Please install it from https://7-zip.org/"
exit 1
}

Write-Host "Extracting archive..."
# Extract the archive
& $7zipPath x "$archivePath" "-o$tempDir" -y

# Find roc.exe recursively in the temp directory
$rocExePath = Get-ChildItem -Path $tempDir -Filter "roc.exe" -Recurse | Select-Object -First 1 -ExpandProperty FullName

if ($rocExePath) {
# Move the executable to the final location
Move-Item $rocExePath $finalPath -Force

# Clean up
Remove-Item $tempDir -Recurse -Force

Write-Host "Roc has been successfully installed to $finalPath"
} else {
Write-Host "Error: Could not find roc.exe in the extracted archive"
exit 1
}
} else {
Write-Host "Roc is already installed at $finalPath"
}
Loading