forked from adnope/scrabble
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprojenv.ps1
More file actions
62 lines (54 loc) · 1.28 KB
/
Copy pathprojenv.ps1
File metadata and controls
62 lines (54 loc) · 1.28 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
# projenv.ps1
# Configure CMake
function configure {
$buildDir = "build"
if (-Not (Test-Path $buildDir)) {
New-Item -ItemType Directory -Path $buildDir
}
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=clang.exe -DCMAKE_CXX_COMPILER:FILEPATH=clang++ --no-warn-unused-cli -S . -B $buildDir -G Ninja
}
# Build all or build a target
function build {
param(
[string]$target
)
$buildDir = "build"
if (-Not (Test-Path $buildDir)) {
configure
}
if (-Not $target) {
cmake --build $buildDir --config Debug --target all
} else {
cmake --build $buildDir --config Debug --target $target
}
}
# Build and run the program
function scrabble {
param(
[string]$arg1,
[string]$arg2,
[string]$arg3
)
build -target "scrabble"
$execPath = "build\bin\scrabble.exe"
if (Test-Path $execPath) {
& $execPath $arg1 $arg2 $arg3
} else {
Write-Host "Error: '$execPath' not found"
}
}
# Build and run the test
function test {
param(
[string]$arg1,
[string]$arg2,
[string]$arg3
)
build -target "scrabble_test"
$execPath = "build\bin\scrabble_test.exe"
if (Test-Path $execPath) {
& $execPath $arg1 $arg2 $arg3
} else {
Write-Host "Error: '$execPath' not found"
}
}