-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_and_run.ps1
More file actions
49 lines (42 loc) · 1.52 KB
/
Copy pathbuild_and_run.ps1
File metadata and controls
49 lines (42 loc) · 1.52 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
# Build and Run Script
# Compiles C++ module and runs Python application
Write-Host "======================================"
Write-Host " SONiC Protocol Debugger - Build"
Write-Host "======================================"
Write-Host ""
# Check for Python
Write-Host "[1/3] Checking Python..."
$pythonCmd = Get-Command python -ErrorAction SilentlyContinue
if ($pythonCmd) {
$pythonVersion = python --version
Write-Host " Found: $pythonVersion" -ForegroundColor Green
} else {
Write-Host " Python not found!" -ForegroundColor Red
exit 1
}
# Check for G++
Write-Host ""
Write-Host "[2/3] Checking C++ compiler..."
$gppCmd = Get-Command g++ -ErrorAction SilentlyContinue
if ($gppCmd) {
$gppVersion = g++ --version | Select-Object -First 1
Write-Host " Found: $gppVersion" -ForegroundColor Green
Write-Host ""
Write-Host " Compiling packet_processor.cpp..."
g++ -o cpp\packet_processor.exe cpp\packet_processor.cpp -std=c++11
if ($LASTEXITCODE -eq 0) {
Write-Host " Compilation successful!" -ForegroundColor Green
} else {
Write-Host " Compilation failed!" -ForegroundColor Yellow
Write-Host " (C++ module is optional, Python app will still run)"
}
} else {
Write-Host " G++ not found - skipping C++ module" -ForegroundColor Yellow
Write-Host " (C++ module is optional, Python app will still run)"
}
Write-Host ""
Write-Host "[3/3] Running Python application..."
Write-Host ""
Write-Host "======================================"
Write-Host ""
python main.py