# 1. Define variables
$BuildDir = "build"
$Config = "Debug"

# 2. Create the build directory if it doesn't exist
if (-not (Test-Path $BuildDir)) {
    New-Item -Path $BuildDir -ItemType Directory
}

# 3. Configure the project
# This is equivalent to 'cmake -B build -S .'
cmake -GNinja -DCMAKE_PREFIX_PATH="C:\Users\arjun\Qt\6.8.6\msvc2022_64" -S . -B $BuildDir

# 4. Build the project
# This works regardless of the generator (Visual Studio, Ninja, etc.)
cmake --build $BuildDir --config $Config

$env:Path += ";C:\Users\arjun\Qt\6.8.6\msvc2022_64\bin"
Write-Host "Build Complete!" -ForegroundColor Green

Start-Process "$BuildDir\llink.exe" -WorkingDirectory $BuildDir

