-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ps1
More file actions
71 lines (61 loc) · 2.46 KB
/
configure.ps1
File metadata and controls
71 lines (61 loc) · 2.46 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# GPUBench Environment Configuration Script
# This script detects the necessary build tools and configures the CMake environment.
Write-Host "=== GPUBench Windows Environment Configurator ===" -ForegroundColor Cyan
# 1. Detect MinGW / MSYS2
$mingwPath = ""
$potentialMingwPaths = @(
"C:\msys64\mingw64\bin",
"C:\msys64\ucrt64\bin",
"C:\ProgramData\chocolatey\bin",
"C:\Program Files\MinGW\bin"
)
foreach ($path in $potentialMingwPaths) {
if (Test-Path "$path\gcc.exe") {
$mingwPath = $path
Write-Host "Found MinGW toolchain at: $mingwPath" -ForegroundColor Green
break
}
}
if ($mingwPath -eq "") {
Write-Host "ERROR: MinGW (gcc.exe) not found in common locations." -ForegroundColor Red
Write-Host "Please install MSYS2 (https://www.msys2.org/) or ensure MingW is in your PATH."
exit 1
}
# Add to current session PATH
$env:PATH = "$mingwPath;C:\msys64\usr\bin;$env:PATH"
# 2. Detect Vulkan SDK
if (-not $env:VULKAN_SDK) {
$vulkanPaths = Get-ChildItem "C:\VulkanSDK" -Directory -ErrorAction SilentlyContinue | Sort-Object Name -Descending
if ($vulkanPaths.Count -gt 0) {
$env:VULKAN_SDK = $vulkanPaths[0].FullName
Write-Host "Detected Vulkan SDK: $($env:VULKAN_SDK)" -ForegroundColor Green
$env:PATH = "$($env:VULKAN_SDK)\Bin;$env:PATH"
} else {
Write-Host "WARNING: Vulkan SDK not found. Vulkan benchmarks will be disabled." -ForegroundColor Yellow
}
} else {
Write-Host "Using VULKAN_SDK from environment: $($env:VULKAN_SDK)" -ForegroundColor Green
$env:PATH = "$($env:VULKAN_SDK)\Bin;$env:PATH"
}
# 3. Detect Generator (Ninja preferred)
$generator = "MinGW Makefiles"
if (Get-Command ninja -ErrorAction SilentlyContinue) {
$generator = "Ninja"
Write-Host "Using Ninja generator" -ForegroundColor Green
} else {
Write-Host "Using MinGW Makefiles generator" -ForegroundColor Green
}
# 4. Run CMake Configuration
$buildDir = "build-release"
if (-not (Test-Path $buildDir)) {
New-Item -ItemType Directory -Path $buildDir | Out-Null
}
Write-Host "`nConfiguring CMake..." -ForegroundColor Cyan
cmake -B $buildDir -S . -G $generator -DCMAKE_BUILD_TYPE=Release
if ($LASTEXITCODE -eq 0) {
Write-Host "`nSUCCESS: Environment configured and CMake project generated." -ForegroundColor Green
Write-Host "You can now build using: cmake --build $buildDir" -ForegroundColor Cyan
} else {
Write-Host "`nERROR: CMake configuration failed." -ForegroundColor Red
exit $LASTEXITCODE
}