Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Build

on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:

# Cancel an in-flight run when a newer commit lands on the same ref.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
label: linux-x86_64
- os: windows-2022
label: windows-x86_64

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

# -------------------------------------------------------------------
# Linux: Microsoft "prod" apt repo for the Azure Kinect SDK (libk4a +
# k4arecord + the dlopen'd depth engine via k4a-tools), plus OpenCV and
# the GLFW/GTK system deps.
#
# The k4a packages are published only under the Ubuntu 18.04 ("bionic")
# prod feed; they install cleanly on 22.04 by adding that feed and
# pointing the suite at "bionic" (the feed has no "jammy" suite, so
# $(lsb_release -cs) would 404 here). The packages carry an interactive
# EULA, so we preseed debconf before apt runs.
# -------------------------------------------------------------------
- name: Install Linux dependencies
if: runner.os == 'Linux'
env:
DEBIAN_FRONTEND: noninteractive
ACCEPT_EULA: 'Y'
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
ca-certificates curl gnupg lsb-release \
build-essential cmake ninja-build pkg-config \
libopencv-dev \
libgl1-mesa-dev libglu1-mesa-dev \
libxinerama-dev libxcursor-dev libxi-dev libxrandr-dev \
libwayland-dev libxkbcommon-dev \
libusb-1.0-0-dev libudev-dev \
libgtk-3-dev

# Microsoft prod apt repo (18.04 / bionic feed) for the Azure Kinect SDK.
# Modern signed-by keyring rather than the deprecated apt-key.
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc \
| sudo gpg --dearmor -o /etc/apt/keyrings/microsoft.gpg
sudo chmod 0644 /etc/apt/keyrings/microsoft.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/18.04/prod bionic main" \
| sudo tee /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update

# Preseed the EULA so libk4a / k4a-tools install non-interactively.
# Hash is the published "accepted-eula-hash" for the 1.4 packages; if
# it is wrong the preseed is silently ignored and apt blocks on the
# prompt until the job times out.
echo 'libk4a1.4 libk4a1.4/accepted-eula-hash string 0f5d5c5de396e4fee4c0753a21fee0c1ed726cf0316204edda484f08cb266d76' \
| sudo debconf-set-selections
echo 'k4a-tools k4a-tools/accepted-eula-hash string 0f5d5c5de396e4fee4c0753a21fee0c1ed726cf0316204edda484f08cb266d76' \
| sudo debconf-set-selections

# libk4a1.4 ships libk4a.so + libk4arecord.so + the dlopen'd
# libdepthengine.so.2.0; -dev adds the headers + CMake/pkg-config that
# find_package(k4a) needs; k4a-tools is belt-and-suspenders for the
# depth engine. Pin matching versions.
sudo apt-get install -y --no-install-recommends \
libk4a1.4=1.4.2 libk4a1.4-dev=1.4.2 k4a-tools=1.4.2

# -------------------------------------------------------------------
# Windows: chocolatey for OpenCV only. The Azure Kinect SDK is VENDORED
# in the repo (extern/k4a/win32) and resolved by CMake from there, so
# there is NO k4a install step. CMake's POST_BUILD copies the 3 k4a DLLs
# next to the exe.
# -------------------------------------------------------------------
- name: Install Windows dependencies
if: runner.os == 'Windows'
timeout-minutes: 25
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'

Write-Host "Installing OpenCV via chocolatey..."
choco install opencv --version=4.10.0 -y --no-progress
$opencvDir = "C:\tools\opencv\build"
if (-not (Test-Path "$opencvDir\OpenCVConfig.cmake")) {
$opencvDir = Get-ChildItem -Path "C:\tools\opencv" -Recurse -Filter "OpenCVConfig.cmake" | Select-Object -First 1 -ExpandProperty Directory | Select-Object -ExpandProperty FullName
}
"OpenCV_DIR=$opencvDir" | Out-File -FilePath $env:GITHUB_ENV -Append
"$opencvDir\x64\vc16\bin" | Out-File -FilePath $env:GITHUB_PATH -Append

# -------------------------------------------------------------------
# Configure + build. Windows is pinned to the x64 VS generator so we
# never accidentally pick up a 32-bit toolchain (the OpenCV and vendored
# k4a libs are x64-only). /MT linkage on Windows + prebuilt OpenCV (/MD)
# relies on the /FORCE linker flag already set in CMakeLists.
# -------------------------------------------------------------------
- name: Configure (Windows x64)
if: runner.os == 'Windows'
run: cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release

- name: Configure (Linux)
if: runner.os == 'Linux'
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

- name: Build
run: cmake --build build --config Release --parallel
Loading
Loading