-
Notifications
You must be signed in to change notification settings - Fork 28
/
install_windows.ps1
87 lines (72 loc) · 2.45 KB
/
install_windows.ps1
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Write-Host
Write-Host "+------------------------------+"
Write-Host "| FicTrac install script |"
Write-Host "+------------------------------+"
Write-Host
$MSYS_DIR = Read-Host -Prompt "Enter full path to MSYS install directory (e.g. C:\msys64)"
$MSYS_BIN_DIR = "$MSYS_DIR\mingw64\bin"
if (Test-Path -Path $MSYS_BIN_DIR) {
Write-Host "Found MSYS bin dir at: $MSYS_BIN_DIR"
}
else {
Write-Host "Uh oh, couldn't find the MSYS bin dir at: $MSYS_BIN_DIR"
exit
}
$USER_PATH = [Environment]::GetEnvironmentVariable("Path", "User")
if (-Not $USER_PATH.contains("$MSYS_BIN_DIR")) {
$Env:PATH += ";$MSYS_BIN_DIR" # set locally in script
[Environment]::SetEnvironmentVariable("Path", $USER_PATH + ";$MSYS_BIN_DIR", "User") # set permanently
Write-Host "MSYS bin dir added to Path variable"
}
Write-Host
Write-Host "+-- Installing dependencies ---+"
Write-Host
Write-Host "Please copy and execute the following command in the MSYS console:"
Write-Host
Write-Host "pacman -Sy mingw-w64-x86_64-gcc \"
Write-Host " mingw-w64-x86_64-make \"
Write-Host " mingw-w64-x86_64-nlopt \"
Write-Host " mingw-w64-x86_64-boost \"
Write-Host " mingw-w64-x86_64-ffmpeg\"
Write-Host " mingw-w64-x86_64-opencv"
Write-Host
Write-Host "Close the MSYS console when all commands have completed successully"
Start-Process "$MSYS_DIR\msys2_shell.cmd" -Wait
Write-Host
Write-Host "+-- Creating build directory --+"
Write-Host
$FICTRAC_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path
cd $FICTRAC_DIR # make sure we are in fictrac dir
if (Test-Path -Path "./build") {
Write-Host "Removing existing build dir"
Remove-Item -Recurse "./build"
}
$null = New-Item -ItemType Directory -Path "./build"
if (Test-Path -Path "./build") {
Write-Host "Created build dir"
cd "./build"
}
else {
Write-Host "Uh oh, something went wrong attempting to create the build dir!"
exit
}
Write-Host
Write-Host "+-- Generating build files ----+"
Write-Host
cmake -G "MinGW Makefiles" --fresh ..
Write-Host
Write-Host "+-- Building FicTrac ----------+"
Write-Host
$NPROC = [Environment]::GetEnvironmentVariable("NUMBER_OF_PROCESSORS")
cmake --build . --config Release --parallel $NPROC --clean-first
cd ..
if (Test-Path "./bin/fictrac.exe" -PathType Leaf) {
Write-Host
Write-Host "FicTrac built successfully!"
Write-Host
}
else {
Write-Host
Write-Host "Hmm... something seems to have gone wrong - can't find FicTrac executable."
Write-Host
}