-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.ps1
More file actions
129 lines (98 loc) · 3.79 KB
/
Copy pathbootstrap.ps1
File metadata and controls
129 lines (98 loc) · 3.79 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
$asciiart=@"
:=-+.
:- .-
-. ::
.-
+*+++*. =. #%@@@:
-=-:::-==@ : =++==+#@@
=-::::--=+:=+++===#==++++-=+===++#@
.*-:::-==# - -++++*#@@
-####@: :: *%@@@.
:.
= .-
-. -.
"@
Write-Host $asciiart
# Define the local vcpkg directory within the cloned repository
$vcpkgDir = "$PSScriptRoot\vcpkg"
$vcpkgExe = "$vcpkgDir\vcpkg.exe"
# Ninja,vcpkg
# Check if vcpkg is available in the system environment
$vcpkgSystemPath = (Get-Command vcpkg -ErrorAction SilentlyContinue).Source
if ($vcpkgSystemPath)
{
Write-Host "System-wide vcpkg found: $vcpkgSystemPath"
}
elseif (Test-Path $vcpkgExe)
{
Write-Host "Local vcpkg found: $vcpkgExe"
}
else
{
Write-Host "vcpkg not found. Installing locally..." -ForegroundColor Yellow
# Clone the vcpkg repository
Write-Host "Cloning vcpkg repository..."
git clone https://github.com/microsoft/vcpkg.git $vcpkgDir
if (!(Test-Path $vcpkgDir)) {
Write-Host "Failed to clone vcpkg repository." -ForegroundColor Red
exit 1
}
# Run the bootstrap script to build vcpkg
Write-Host "Bootstrapping vcpkg..."
& "$vcpkgDir\bootstrap-vcpkg.bat"
if (Test-Path $vcpkgExe)
{
Write-Host "vcpkg installation completed successfully." -ForegroundColor Green
# Add vcpkg to the environment PATH (only for this session)
$env:PATH = "$vcpkgDir;$env:PATH"
Write-Host "vcpkg set for local path env var"
} else {
Write-Host "vcpkg installation failed." -ForegroundColor Red
exit 1
}
Write-Host "Installing dependency" -ForegroundColor Yellow
& vcpkg install
}
# vcpkg section up.
Write-Host "Performing Cmake Configuration" -ForegroundColor Yellow
# Check if CMake is installed
$cmakeExe = (Get-Command cmake -ErrorAction SilentlyContinue).Source
if (-not $cmakeExe)
{
Write-Host "CMake not found! Installing using winget..." -ForegroundColor Yellow
# Install CMake using winget
winget install Kitware.CMake --silent
# Refresh the environment to detect CMake
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
$cmakeExe = (Get-Command cmake -ErrorAction SilentlyContinue).Source
if (-not $cmakeExe) {
Write-Host "CMake installation failed!" -ForegroundColor Red
exit 1
}
}
# Run CMake to list available generators
$cmakeGenerators = & cmake --help | Select-String "Generators" -Context 0,50 | Out-String
Write-Host "Available CMake Generators: $cmakeGenerators"
Write-Host "switching to build directory" -ForegroundColor DarkYellow
& mkdir build -ErrorAction ignore
& cd build
$selected_generator=Read-Host "copy and paste the genrator from the list"
Write-host "selected generator is: $selected_generator" -BackgroundColor Cyan
do {
# Prompt user for input
$response = Read-Host "Do you want to continue? (yes/no)"
# Convert input to lowercase for case-insensitive comparison
$response = $response.Trim().ToLower()
if ($response -eq "yes") {
Write-Host "Proceeding..." -ForegroundColor Green
break # Exit loop
}
elseif ($response -eq "no") {
Write-Host "You selected No. Asking again..." -ForegroundColor Yellow
}
else {
Write-Host "Invalid input. Please enter 'yes' or 'no'." -ForegroundColor Red
}
} while ($true) # Infinite loop until 'yes' is entered
& cmake ../synapse -G $selected_generator
& cmake --build .