-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.ps1
More file actions
66 lines (53 loc) · 1.84 KB
/
run.ps1
File metadata and controls
66 lines (53 loc) · 1.84 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
param(
[switch]$cangateway,
[switch]$nobuildcangateway
)
$current_path = Get-Location
$env:CGO_ENABLED = "1"
$env:GOGC = "100"
$env:CC = "clang.exe"
$env:CXX = "clang.exe"
if ($cangateway) {
# $includes = @(
# 'C:\Progra~2\Kvaser\Canlib\INC'
# )
# $env:CGO_CFLAGS = ($includes | ForEach-Object { '-I' + $_ }) -join ' '
# $libs = @(
# 'C:\Progra~2\Kvaser\Canlib\Lib\MS'
# )
# $env:CGO_LDFLAGS = ($libs | ForEach-Object { '-L' + $_ }) -join ' '
$env:GOARCH = "386"
go run -tags="j2534" github.com/roffe/gocangateway $args
exit
}
if (-not $nobuildcangateway) {
& "$current_path\build.ps1" -cangateway
}
$includes = @(
"$current_path\vcpkg\packages\libusb_x64-windows\include\libusb-1.0"
#'C:\Progra~2\Kvaser\Canlib\INC'
#"$current_path\canusb\include"
)
$env:CGO_CFLAGS = ($includes | ForEach-Object { '-I' + $_ }) -join ' '
# $libs = @(
# 'C:\Progra~2\Kvaser\Canlib\Lib\x64',
# "$current_path\canusb\lib64"
# )
# $env:CGO_LDFLAGS = ($libs | ForEach-Object { '-L' + $_ }) -join ' '
$env:PKG_CONFIG_PATH = "$current_path\vcpkg\packages\libusb_x64-windows\lib\pkgconfig"
$env:GOARCH = "amd64"
if (-not (Test-Path -Path ".\canusbdrv64.dll")) {
Write-Output "Copy canusbdrv64.dll"
Copy-Item -Path "canusb\dll64\canusbdrv64.dll" -Destination ".\" -Force
}
if (-not (Test-Path -Path ".\libusb-1.0.dll")) {
Write-Output "Copy libusb-1.0.dll"
Copy-Item -Path "vcpkg\packages\libusb_x64-windows\bin\libusb-1.0.dll" -Destination ".\" -Force
}
$firmware = "$Env:USERPROFILE\Documents\PlatformIO\Projects\txbridge\.pio\build\esp32dev\firmware.bin"
if (Test-Path -Path $firmware) {
Write-Output "Copy firmware.bin to pkg\ota"
Copy-Item -Path $firmware -Destination ".\pkg\ota\" -Force
}
write-Output "Run txlogger"
go run -tags="canlib,canusb,combi,ftdi,j2534,pcan,rcan" . $args