-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.ps1
More file actions
65 lines (59 loc) · 1.57 KB
/
build.ps1
File metadata and controls
65 lines (59 loc) · 1.57 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
# Custom build script (windows powershell).
#
# Usage:
# .\build.ps1: clean, compile and run
# .\build.ps1 -clean: clean compiled file
# .\build.ps1 -cleanAndCompile: clean compiled file and compile the project
# .\build.ps1 -compile: compile the project
# .\build.ps1 -compileAndRun: compile the project and run the compiled file
# .\build.ps1 -run: run the compiled file
#
# Author: Prof. Dr. David Buzatto
param(
[switch]$clean,
[switch]$cleanAndCompile,
[switch]$compile,
[switch]$compileAndRun,
[switch]$run
);
$CurrentFolderName = Split-Path -Path (Get-Location) -Leaf
$CompiledFile = "$CurrentFolderName.exe"
$all = $false
if ( -not( $clean -or $cleanAndCompile -or $compile -or $compileAndRun -or $run ) ) {
$all = $true
}
# clean
if ( $clean -or $cleanAndCompile -or $all ) {
Write-Host "Cleaning..."
if ( Test-Path $CompiledFile ) {
Remove-Item $CompiledFile
}
}
# compile
if ( $compile -or $cleanAndCompile -or $compileAndRun -or $all ) {
Write-Host "Compiling..."
g++ src/*.cpp -o $CompiledFile `
-O1 `
-Wall `
-Wextra `
-Wno-unused-parameter `
-pedantic-errors `
-std=c++20 `
-Wno-missing-braces `
-I src/include/ `
-I src/include/external `
-L lib/ `
-lraylib `
-lopengl32 `
-lgdi32 `
-lwinmm
}
# run
if ( $run -or $compileAndRun -or $all ) {
Write-Host "Running..."
if ( Test-Path $CompiledFile ) {
& .\$CompiledFile
} else {
Write-Host "$CompiledFile does not exists!"
}
}