Repository navigation
157 lines (153 loc) · 6.14 KB
/
Copy pathbuild-natives.yml
File metadata and controls
157 lines (153 loc) · 6.14 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Build zed-java-api natives
on:
workflow_dispatch:
permissions:
contents: write
# For the Linux builds, see https://www.stereolabs.com/docs/docker/building-arm-container-on-x86
jobs:
build-linux-x86_64:
runs-on: [ubuntu-22.04]
container:
image: stereolabs/zed:5.5-devel-cuda12.8-ubuntu24.04
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install git wget curl build-essential unzip -y
- uses: actions/checkout@v6
- name: Mark workspace as safe
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Compile native library (x86_64)
run: |
bash cppbuild.bash
- name: Commit generated java and native libraries
uses: EndBug/add-and-commit@v9
with:
add: '*.java *.so' # Only commit generated java from Linux
author_name: ihmc-rosie
author_email: rosie@ihmc.us
message: 'Rebuild natives for Linux (x86_64)'
push: true
build-linux-l4t:
runs-on: [ubuntu-22.04-arm]
container:
image: stereolabs/zed:5.5-devel-l4t-r36.4
needs: [build-linux-x86_64]
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install git wget curl build-essential openjdk-17-jdk unzip libusb-1.0-0-dev -y
# Cannot use for now, see https://github.com/actions/setup-node/issues/922
# - uses: actions/checkout@v4
- name: Checkout
run: |
mkdir -p /work && cd /work
git clone https://github.com/ihmcrobotics/zed-java-api
cd zed-java-api
git checkout ${{ github.ref_name }}
# Cannot use for now, see https://github.com/actions/setup-node/issues/922
# - uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: '17'
- name: Compile native library (arm64)
run: |
cd /work/zed-java-api
export CMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$CMAKE_LIBRARY_PATH
# Force the linker to ignore the fact that the stub is just a placeholder
export CXXFLAGS="-Wl,--allow-shlib-undefined"
LINUX_CROSS_COMPILE_ARM=1 bash cppbuild.bash
- name: Commit generated java and native libraries
run: |
git config --global user.name 'ihmc-rosie'
git config --global user.email 'rosie@ihmc.us'
git config --global url."https://github.com/".insteadOf git@github.com:
cd /work/zed-java-api
git remote set-url origin https://${{ secrets.ROSIE_PERSONAL_ACCESS_TOKEN }}@github.com/ihmcrobotics/zed-java-api.git
git add *.so
if git diff --cached --quiet; then
echo "No arm64 library changes to commit"
else
git commit -m 'Rebuild natives for Linux (arm64)'
git push
fi
# Cannot use for now, see https://github.com/actions/setup-node/issues/922
# - name: Commit generated java and native libraries
# uses: EndBug/add-and-commit@v9
# with:
# add: '*.so' # Only commit generated java from Linux x86_64
# author_name: ihmc-rosie
# author_email: rosie@ihmc.us
# message: 'Rebuild natives for Linux (arm64)'
# push: true
- name: Clean workspace
if: ${{ always() }}
run: rm -rf /work/*
build-windows:
runs-on: [windows-2022]
needs: [build-linux-l4t]
steps:
- uses: actions/checkout@v6
- name: Pull repo
run: |
git reset --hard
git pull
- uses: Jimver/cuda-toolkit@v0.2.30
id: cuda-toolkit
with:
cuda: '12.8.0'
method: 'network'
- name: Install ZED SDK
run: |
# The installer is an Inno Setup archive. Running it on a runner hangs, and most of
# the payload is TensorRT. Extract only the headers, import library, and CMake files.
curl.exe -L -o ZED_SDK.exe https://download.stereolabs.com/zedsdk/5.5.1/cu12_trt10/win
curl.exe -L -o innoextract.zip https://github.com/dscharrer/innoextract/releases/download/1.9/innoextract-1.9-windows.zip
Expand-Archive innoextract.zip -DestinationPath innoextract
$inno = Get-ChildItem -Recurse innoextract -Filter innoextract.exe | Select-Object -First 1
# -I is a prefix match. Pass both separators; the Windows build compares backslashes.
& $inno.FullName --extract -d zed-extract `
-I 'app/include' -I 'app\include' `
-I 'app/lib' -I 'app\lib' `
-I 'app/zed-config.cmake' -I 'app\zed-config.cmake' `
-I 'app/zed-config-version.cmake' -I 'app\zed-config-version.cmake' `
ZED_SDK.exe
if (-not (Test-Path 'zed-extract\app')) {
Get-ChildItem -Recurse zed-extract, app -ErrorAction SilentlyContinue | Select-Object -First 40 FullName
throw "innoextract did not write zed-extract\app"
}
$dest = "C:\Program Files (x86)\ZED SDK"
New-Item -ItemType Directory -Force -Path $dest | Out-Null
Copy-Item -Recurse -Force zed-extract\app\* $dest
$versionFile = Join-Path $dest "zed-config-version.cmake"
if (-not (Test-Path $versionFile)) { throw "ZED SDK headers were not extracted to $versionFile" }
Get-Content $versionFile
- uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: 2022
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Check Java/Gradle versions
run: |
java --version
gradle --version
- name: Compile native library
run: |
$env:ZED_SDK_ROOT_DIR = "C:\Program Files (x86)\ZED SDK"
bash.exe cppbuild.bash
- name: Commit native libraries
uses: EndBug/add-and-commit@v9
with:
add: '*.dll' # Only commit generated java from Linux
author_name: ihmc-rosie
author_email: rosie@ihmc.us
message: 'Rebuild natives for Windows'
push: true