Skip to content

Commit 9eb4e7b

Browse files
authored
Update OpenVR to v2.5.1, no longer using static bindings committed manually, 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.
1 parent 055337e commit 9eb4e7b

File tree

7 files changed

+44
-13618
lines changed

7 files changed

+44
-13618
lines changed

.github/workflows/rust.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ "*" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
name: "Build and test ${{ matrix.os }} with Rust ${{ matrix.rustc-version }}"
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [windows-latest, ubuntu-latest, macOS-latest]
19+
rustc-version: [1.82.0, 1.83.0, 1.84.0]
20+
fail-fast: false
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
submodules: true
26+
- name: Install Rust ${{ matrix.rustc-version }}
27+
run: |
28+
rustup install ${{ matrix.rustc-version }}
29+
rustup default ${{ matrix.rustc-version }}
30+
- name: Build
31+
run: cargo build --verbose
32+
- name: Run tests
33+
run: cargo test --verbose

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ Cargo.lock
77

88
/.idea/
99
/.vscode/
10+
11+
bindings.rs

Cargo.toml

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
[package]
22
name = "openvr_sys"
3-
version = "2.0.3"
3+
version = "2.1.0"
4+
edition = "2021"
5+
rust-version = "1.82.0"
46
authors = [
57
"Colin Sherratt",
68
"Erick Tryzelaar",
79
"Rene Eichhorn",
8-
"Benjamin Saunders"
10+
"Benjamin Saunders",
11+
"Alexander Brook Perry",
12+
"Arthur Brainville"
913
]
1014
license = "MIT"
1115
description = "Raw unsafe system binding for openvr"
@@ -25,13 +29,12 @@ build = "build.rs"
2529
maintenance = { status = "passively-maintained" }
2630

2731
[build-dependencies]
28-
cmake = "0.1"
29-
bindgen = { version = "0.49", optional = true }
32+
cmake = "0.1.52"
33+
bindgen = "0.71.1"
3034

3135
[lib]
3236
name = "openvr_sys"
3337
path = "lib.rs"
3438

3539
[features]
3640
default = []
37-
buildtime_bindgen = ["bindgen"]

README.md

-19
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,4 @@ Contains function definitions for the [OpenVR](https://github.com/ValveSoftware/
66

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

12-
## Workaround for broken OpenVR ABIs (Linux/macOS only)
13-
14-
Search for packed structs in `headers/openvr.h`, i.e., `#pragma pack( push, 4 )`. Currently, that is:
15-
16-
```
17-
VRControllerState_t
18-
RenderModel_TextureMap_t
19-
RenderModel_t
20-
VREvent_t
21-
```
22-
23-
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:
24-
25-
```rust
26-
#[repr(C)]
27-
#[cfg_attr(unix, repr(packed(4)))]
28-
```

0 commit comments

Comments
 (0)