Missing functions (#21)

- add some missing functions
- added config.h for users that vendor Box3D
- joint unit tests
- improve joint limit consistency
- extend build matrix
This commit is contained in:
Erin Catto 2026-06-30 10:57:46 -07:00 • committed by GitHub
commit 8441b4a06d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 918 additions and 410 deletions

View file

@ -2,58 +2,77 @@
name: CI Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
BUILD_TYPE: Debug
BUILD_TYPE: Debug
jobs:
build-ubuntu-gcc:
name: ubuntu-gcc
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 4
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.timeout || 4 }}
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-gcc
os: ubuntu-latest
test: ./bin/test
- name: ubuntu-clang
os: ubuntu-latest
args: '-DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread"'
test: ./bin/test
- name: ubuntu-clang-msan
os: ubuntu-latest
timeout: 10
args: '-DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=memory"'
test: ./bin/test
msan-options: abort_on_error=1:halt_on_error=1
- name: macos
os: macos-latest
args: -DBOX3D_SANITIZE=ON
test: ./bin/test
- name: windows
os: windows-latest
msvc: true
args: -DBOX3D_SANITIZE=ON
test: ./bin/Debug/test
# Box3D is width-4 SIMD only, so this covers the clang-cl toolchain, not AVX2.
- name: windows-clang-cl
os: windows-latest
msvc: true
args: -T ClangCL
test: ./bin/Debug/test
- name: windows-arm64
os: windows-11-arm
args: -A arm64 -DBOX3D_DISABLE_SIMD=TRUE -DBOX3D_SANITIZE=ON
test: ./bin/Debug/test
- name: ubuntu-gcc-double
os: ubuntu-latest
args: -DBOX3D_DOUBLE_PRECISION=ON
test: ./bin/test
- name: windows-double
os: windows-latest
msvc: true
args: -DBOX3D_DOUBLE_PRECISION=ON -DBOX3D_SANITIZE=ON
test: ./bin/Debug/test
steps:
- uses: actions/checkout@v6
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ./bin/test
build-ubuntu-clang:
name: ubuntu-clang
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 4
steps:
- uses: actions/checkout@v6
- name: Setup MSVC dev command prompt
if: ${{ matrix.msvc }}
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ./bin/test
build-ubuntu-clang-msan:
name: ubuntu-clang-msan
runs-on: ubuntu-latest
if: false # todo re-enable once repo is public
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_C_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=1 -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=memory" -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON ${{ matrix.args }}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
@ -61,132 +80,88 @@ jobs:
- name: Test
working-directory: ${{github.workspace}}/build
env:
MSAN_OPTIONS: abort_on_error=1:halt_on_error=1
MSAN_OPTIONS: ${{ matrix['msan-options'] || '' }}
run: ${{ matrix.test }}
# mingw needs some extra setup so keeping it separate from the matrix.
build-windows-mingw:
name: windows-mingw
runs-on: windows-latest
timeout-minutes: 4
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v6
- name: Setup MSYS2 UCRT64
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ninja
- name: Configure CMake
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: build
run: ./bin/test
build-macos:
name: macos
runs-on: macos-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 4
samples:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 8
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
include:
- name: samples-ubuntu-gcc-static
os: ubuntu-latest
linux-deps: true
args: -DBUILD_SHARED_LIBS=OFF
- name: samples-macos-static
os: macos-latest
args: -DBUILD_SHARED_LIBS=OFF
- name: samples-macos-dynamic
os: macos-latest
args: -DBUILD_SHARED_LIBS=ON
- name: samples-windows-static
os: windows-latest
msvc: true
args: -DBUILD_SHARED_LIBS=OFF
- name: samples-windows-double
os: windows-latest
msvc: true
args: -DBOX3D_DOUBLE_PRECISION=ON -DBUILD_SHARED_LIBS=OFF
- name: samples-windows-dynamic
os: windows-latest
msvc: true
args: -DBUILD_SHARED_LIBS=ON
steps:
- uses: actions/checkout@v6
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBOX3D_SANITIZE=ON -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ./bin/test
build-windows:
name: windows
runs-on: windows-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 4
steps:
- uses: actions/checkout@v6
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_SAMPLES=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ./bin/${{env.BUILD_TYPE}}/test
build-ubuntu-double:
name: ubuntu-double-precision
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 4
steps:
- uses: actions/checkout@v6
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_DOUBLE_PRECISION=ON -DBOX3D_SAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ./bin/test
build-windows-double:
name: windows-double-precision
runs-on: windows-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 4
steps:
- uses: actions/checkout@v6
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBOX3D_DOUBLE_PRECISION=ON -DBOX3D_SAMPLES=OFF -DBOX3D_VALIDATE=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ./bin/${{env.BUILD_TYPE}}/test
samples-windows:
name: samples-windows
runs-on: windows-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 6
steps:
- uses: actions/checkout@v6
- name: Setup MSVC dev command prompt
if: ${{ matrix.msvc }}
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBOX3D_SAMPLES=ON -DBUILD_SHARED_LIBS=OFF -DBOX3D_UNIT_TESTS=OFF
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release
samples-macos:
name: samples-macos
runs-on: macos-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 6
steps:
- uses: actions/checkout@v6
# sokol_app needs X11/Xi/Xcursor + GL, the file dialog needs GTK3.
- name: Install Linux sample dependencies
if: ${{ matrix['linux-deps'] }}
run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev libx11-dev libxi-dev libxcursor-dev libgtk-3-dev
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBOX3D_SAMPLES=ON -DBUILD_SHARED_LIBS=OFF -DBOX3D_UNIT_TESTS=OFF
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBOX3D_SAMPLES=ON -DBOX3D_UNIT_TESTS=OFF ${{ matrix.args }}
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release
samples-windows-double:
name: samples-windows-double-precision
runs-on: windows-latest
if: github.event_name == 'push' || github.event.pull_request.draft == false
timeout-minutes: 6
steps:
- uses: actions/checkout@v6
- name: Setup MSVC dev command prompt
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBOX3D_DOUBLE_PRECISION=ON -DBOX3D_SAMPLES=ON -DBUILD_SHARED_LIBS=OFF -DBOX3D_UNIT_TESTS=OFF
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release