Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update OpenVR to v2.5.1, no longer using static bindings committed manually, workflow for building and testing on all platforms #15

Merged
merged 4 commits into from
Jan 30, 2025
Merged
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
33 changes: 33 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Rust

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: "Build and test ${{ matrix.os }} with Rust ${{ matrix.rustc-version }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
rustc-version: [1.82.0, 1.83.0, 1.84.0]
fail-fast: false

steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust ${{ matrix.rustc-version }}
run: |
rustup install ${{ matrix.rustc-version }}
rustup default ${{ matrix.rustc-version }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Cargo.lock

/.idea/
/.vscode/

bindings.rs
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
[package]
name = "openvr_sys"
version = "2.0.3"
version = "2.1.0"
edition = "2021"
rust-version = "1.82.0"
authors = [
"Colin Sherratt",
"Erick Tryzelaar",
"Rene Eichhorn",
"Benjamin Saunders"
"Benjamin Saunders",
"Alexander Brook Perry",
"Arthur Brainville"
]
license = "MIT"
description = "Raw unsafe system binding for openvr"
Expand All @@ -25,13 +29,12 @@ build = "build.rs"
maintenance = { status = "passively-maintained" }

[build-dependencies]
cmake = "0.1"
bindgen = { version = "0.49", optional = true }
cmake = "0.1.52"
bindgen = "0.71.1"

[lib]
name = "openvr_sys"
path = "lib.rs"

[features]
default = []
buildtime_bindgen = ["bindgen"]
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,4 @@ Contains function definitions for the [OpenVR](https://github.com/ValveSoftware/

1. `git submodule update --init --recursive` (initial checkout only)
1. `git submodule foreach git pull origin master` to update the submodule
1. `cargo build --features "buildtime_bindgen"` to update the bindings
1. Apply the workaround for broken OpenVR ABIs, if required

## Workaround for broken OpenVR ABIs (Linux/macOS only)

Search for packed structs in `headers/openvr.h`, i.e., `#pragma pack( push, 4 )`. Currently, that is:

```
VRControllerState_t
RenderModel_TextureMap_t
RenderModel_t
VREvent_t
```

Depending on what bindgen did parse, you have to replace a bunch of `#[repr(C)]` and `#[repr(C, packed(4))]` precending those structs in `bindings.rs` with:

```rust
#[repr(C)]
#[cfg_attr(unix, repr(packed(4)))]
```
Loading