diff --git a/make.ps1 b/make.ps1 new file mode 100644 index 00000000..8d7a3c44 --- /dev/null +++ b/make.ps1 @@ -0,0 +1,67 @@ +param ( + [string]$arch = 'x64' +) + +$buildArch = 'x64' + +# only x86 / x64 is supported +if(-NOT (($arch -eq 'x64') -or ($arch -eq 'x86'))) { + Write-Host "Invalid argument '$arch' - only 'x86' and 'x64' is supported" + return +} + +if($arch -eq 'x86') { + $buildArch = 'Win32' +} + +$buildPath = "./build/win-$arch" + +Write-Host "##################################################################" +Write-Host "glfw build script" +Write-Host "##################################################################" +Write-Host "" +Write-Host "-----------------------------" +Write-Host "### configuration" +Write-Host "-----------------------------" + +Write-Host "arch: $arch" +Write-Host "path: $buildPath" + +Write-Host "" +Write-Host "-----------------------------" +Write-Host "### preparation:" +Write-Host "-----------------------------" +Write-Host "" + +if (Test-Path $buildPath) { + Get-ChildItem -Path $buildPath -Recurse | Remove-Item -force -recurse + Remove-Item $buildPath -force + Write-Host "deleted build folder" + Write-Host "" +} + +New-Item -ItemType directory -Path $buildPath | Out-Null +Write-Host "created build folder" +Write-Host "" +Write-Host "-----------------------------" +Write-Host "### cmake - preparing build" +Write-Host "-----------------------------" +Write-Host "" + +cmake -S . -B $buildPath -A $buildArch -D BUILD_SHARED_LIBS=ON + +Write-Host "" +Write-Host "-----------------------------" +Write-Host "### cmake - building $arch" +Write-Host "-----------------------------" +Write-Host "" + +cd $buildPath +cmake --build . --config Release + +cd ..\.. +Write-Host "" +Write-Host "-----------------------------" + + +