Skip to content

Commit

Permalink
Update OpenVR to v2.5.1, no longer using static bindings committed ma…
Browse files Browse the repository at this point in the history
…nually, workflow for building and testing on all platforms (#15)

* Added a workflow to compile on windows, linux, and mac.

* Update openvr v2.5.1 (#1)

* Update openvr dependency to v2.5.1.

* Update dependencies and rebuild bindings - no longer get errors generating bindings or running tests (on Windows at least).

* Run actions on every branch.

* Remove the buildtime_bindgen feature, lets just always generate bindings since they need to be different on each platform. In the future if needed windows, mac, and linux bindings could be prebuilt and committed and used via a feature for quicker builds.

* Fix missing import, add edition to Cargo.toml.

* Update version to 2.1.0.

* Set min support rust version to 1.82 and test 1.82-1.84  (#2)

* Run workflow on multiple versions of rustc.

* It seems the unsafe extern issue was fixed in 1.82 so min version will be 1.82 and we will test 1.82 to 1.84.

* Remove workaround instructions from README as no longer necessary.
  • Loading branch information
alexgeek authored Jan 30, 2025
1 parent 055337e commit 9eb4e7b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 13,618 deletions.
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

0 comments on commit 9eb4e7b

Please sign in to comment.