mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
This adds support for two serialization formats for complex data types: - Protobuf for complex objects with variable length internals that need forward and backward wire compatibility (lower speed, more flexible) - Raw struct (ByteBuffer-style) for fixed-length objects (higher speed, less flexible) Deserialization can be done either by creating a new object (for immutable objects) or overwriting the contents of an existing object (for mutable objects). Implementing classes should provide inner classes that implement the Protobuf or Struct interface (in Java) or specialize the wpi::Protobuf or wpi::Struct struct (in C++). It is possible for classes to implement both. If the class itself does not implement serialization, it's possible for third parties/users to provide an implementation instead. Uses the Google protobuf implementation for C++ and the QuickBuffers alternative protobuf implementation for Java.
123 lines
4.2 KiB
YAML
123 lines
4.2 KiB
YAML
name: CMake
|
|
|
|
on: [pull_request, push]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-22.04
|
|
name: Linux
|
|
container: wpilib/roborio-cross-ubuntu:2024-22.04
|
|
flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON"
|
|
- os: macOS-12
|
|
name: macOS
|
|
container: ""
|
|
env: "PATH=\"/usr/local/opt/protobuf@3/bin:$PATH\""
|
|
flags: "-DCMAKE_BUILD_TYPE=Release -DWITH_JAVA=OFF -DWITH_EXAMPLES=ON -DCMAKE_LIBRARY_PATH=/usr/local/opt/protobuf@3/lib -DProtobuf_INCLUDE_DIR=/usr/local/opt/protobuf@3/include -DProtobuf_PROTOC_EXECUTABLE=/usr/local/opt/protobuf@3/bin/protoc"
|
|
|
|
name: "Build - ${{ matrix.name }}"
|
|
runs-on: ${{ matrix.os }}
|
|
container: ${{ matrix.container }}
|
|
steps:
|
|
- name: Install dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv4.5-java python-is-python3 libprotobuf-dev protobuf-compiler ninja-build
|
|
|
|
- name: Install QuickBuffers (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.2/protoc-gen-quickbuf_1.3.2_amd64.deb && sudo apt install ./protoc-gen-quickbuf_1.3.2_amd64.deb
|
|
|
|
- name: Install opencv (macOS)
|
|
run: brew install opencv protobuf@3 ninja
|
|
if: runner.os == 'macOS'
|
|
|
|
- name: Set up Python 3.8 (macOS)
|
|
if: runner.os == 'macOS'
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.8
|
|
|
|
- name: Run sccache-cache
|
|
uses: mozilla-actions/sccache-action@v0.0.3
|
|
|
|
- name: Install jinja
|
|
run: python -m pip install jinja2
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: configure
|
|
run: cmake -S . -B build -G "Ninja" -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ${{ matrix.flags }}
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
|
|
- name: build
|
|
working-directory: build
|
|
run: cmake --build . --parallel $(nproc)
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
|
|
- name: test
|
|
working-directory: build
|
|
run: ctest --output-on-failure
|
|
|
|
build-windows:
|
|
name: "Build - Windows"
|
|
runs-on: windows-2022
|
|
steps:
|
|
- uses: ilammy/msvc-dev-cmd@v1
|
|
|
|
- name: Install CMake
|
|
uses: lukka/get-cmake@v3.27.6
|
|
|
|
- name: Run vcpkg
|
|
uses: lukka/run-vcpkg@v11.1
|
|
with:
|
|
vcpkgDirectory: ${{ runner.workspace }}/vcpkg
|
|
vcpkgGitCommitId: 78b61582c9e093fda56a01ebb654be15a0033897 # HEAD on 2023-08-6
|
|
|
|
- name: Run sccache-cache
|
|
uses: mozilla-actions/sccache-action@v0.0.3
|
|
|
|
- name: Install jinja
|
|
run: python -m pip install jinja2
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: configure
|
|
run: cmake -S . -B build -G "Ninja" -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE=Release -DWITH_JAVA=OFF -DWITH_EXAMPLES=ON -DUSE_SYSTEM_FMTLIB=ON -DUSE_SYSTEM_LIBUV=ON -DUSE_SYSTEM_EIGEN=ON -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_INSTALL_OPTIONS=--clean-after-build -DVCPKG_TARGET_TRIPLET=x64-windows-release -DVCPKG_HOST_TRIPLET=x64-windows-release
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
|
|
# Build wpiutil at full speed, wpimath depends on wpiutil
|
|
- name: build wpiutil
|
|
working-directory: build
|
|
run: cmake --build . --parallel $(nproc) --target wpiutil/all
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
|
|
# Build wpimath slow to prevent OOM
|
|
- name: build wpimath
|
|
working-directory: build
|
|
run: cmake --build . --parallel 1 --target wpimath/all
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
|
|
# Build everything else fast
|
|
- name: build
|
|
working-directory: build
|
|
run: cmake --build . --parallel $(nproc)
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
|
|
- name: test
|
|
working-directory: build
|
|
# UnitTest_test segfaults on exit occasionally
|
|
run: ctest --output-on-failure -E 'UnitTest'
|