Skip to content

Commit

Permalink
Remove the ffi-headers feature
Browse files Browse the repository at this point in the history
Rely on a separate cbindgen instance instead, which is less self-contained but more practical.
  • Loading branch information
Ortham committed Apr 30, 2024
1 parent adeac23 commit c508533
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 191 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ jobs:
# Need to rebuild the FFI wrapper so that its binary is given a filename
# without a hash.
- name: Build FFI wrapper
run: cargo build --manifest-path ffi/Cargo.toml --features ffi-headers
run: |
cargo build --manifest-path ffi/Cargo.toml
cbindgen ffi/ -o ffi/include/loot_condition_interpreter.h
# Use bash because PowerShell doesn't fail if one command fails.
- name: Build and run C++ tests
Expand Down Expand Up @@ -120,7 +122,9 @@ jobs:
# Need to rebuild the FFI wrapper so that its binary is given a filename
# without a hash.
- name: Build FFI wrapper
run: cargo build --manifest-path ffi/Cargo.toml --features ffi-headers
run: |
cargo build --manifest-path ffi/Cargo.toml
cbindgen ffi/ -o ffi/include/loot_condition_interpreter.h
# Use bash because PowerShell doesn't fail if one command fails.
- name: Build and run C++ tests
Expand Down
153 changes: 7 additions & 146 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,7 @@ To build the Rust and C FFI libraries, run:
cargo build --release --package loot-condition-interpreter-ffi
```

To generate a C++ header file as part of the build, instead run:

```
cargo build --release --package loot-condition-interpreter-ffi --all-features
```

This will create a file at `ffi/include/loot_condition_interpreter.h`.
However, this involves building [cbindgen](https://github.com/eqrion/cbindgen)
as a dependency, which is relatively slow. If you have cbindgen installed
separately, it's faster to generate the headers using its CLI:
Use [cbindgen](https://github.com/eqrion/cbindgen) to generate a C++ header file:

```
cbindgen ffi/ -o ffi/include/loot_condition_interpreter.h
Expand Down
8 changes: 0 additions & 8 deletions ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "loot-condition-interpreter-ffi"
version = "3.1.0"
authors = ["Oliver Hamlet <[email protected]>"]
license = "MIT"
build = "build.rs"
edition = "2018"

[dependencies]
Expand All @@ -13,10 +12,3 @@ libc = "0.2"
[lib]
name = "loot_condition_interpreter_ffi"
crate-type = ["staticlib"]

[features]
default = []
ffi-headers = ["cbindgen"]

[build-dependencies]
cbindgen = { version = "0.26", optional = true }
25 changes: 0 additions & 25 deletions ffi/build.rs

This file was deleted.

0 comments on commit c508533

Please sign in to comment.