Skip to content
Draft
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
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

The format is based on [Common Changelog](https://common-changelog.org/) and [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [0.4.0] - Unreleased

### Removed

- **Breaking:** Removed duplicated definitions of ctypes, use these types from `std::ffi` or `core::ffi` instead.
- Removed definitions: `c_void`, `c_char`, `c_double`, `c_float`, `c_int`, `c_long`, `c_longlong`, `c_schar`, `c_short`, `c_uchar`, `c_uint`, `c_ulong`, `c_ulonglong`, `c_ushort`.

## [0.3.3] - 2024-02-25

### Changed

- Bindings are now pre-generated by default, meaning that LLVM / Clang is no longer requried to be installed (#21, #24).
- Bindings are now pre-generated by default, meaning that LLVM / Clang is no longer required to be installed (#21, #24).
- There's a new `bindgen` feature which makes the crate generate bindings at compile-time by using headers at `$VITASDK` instead of using pre-generated bindings (#21).
- Simplified CI by using vita-rust-bot to create PRs (#23).

Expand All @@ -28,9 +35,9 @@ _This release includes a rewrite of the whole binding generation process by @Zet

### Changed

- **Breaking** The bindings are now generated on a flat structure, so now all items are defined at the root of the crate.
- **Breaking** Items are now defined based on features, each feature corresponding to a stub file. Enabling the feature will cause the required stub to be linked.
- **Breaking** Bindings are now generated at build-time, so [bindgen's requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) need to be installed.
- **Breaking:** The bindings are now generated on a flat structure, so now all items are defined at the root of the crate.
- **Breaking:** Items are now defined based on features, each feature corresponding to a stub file. Enabling the feature will cause the required stub to be linked.
- **Breaking:** Bindings are now generated at build-time, so [bindgen's requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) need to be installed.
- Improvements to CI, including new checks for docs (which uploads generated docs as an artifact).

## [0.2.0] - 2023-09-12
Expand Down
2 changes: 1 addition & 1 deletion build-util/src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn generate_preprocessed_bindings(
.clang_arg("-I".to_string() + vita_headers_include.to_str().unwrap())
.clang_args(&["-target", "armv7a-none-eabihf"])
.use_core()
.ctypes_prefix("crate::ctypes")
.ctypes_prefix("core::ffi")
.generate_comments(false)
.prepend_enum_name(false)
.layout_tests(false)
Expand Down
13 changes: 11 additions & 2 deletions build-util/src/visitors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ impl Link {

self.function
.get(&symbol)
.expect("Undefined foreign fn `{symbol}`")
.unwrap_or_else(|| panic!("Undefined foreign fn `{symbol}`"))
.to_owned()
}
ForeignItem::Static(static_item) => {
let symbol = static_item.ident.to_string();

self.variable
.get(&symbol)
.expect("Undefined foreign static `{symbol}`")
.unwrap_or_else(|| panic!("Undefined foreign static `{symbol}`"))
.to_owned()
}
_ => panic!("unexpected foreign item: {:?}", foreign_item),
Expand Down Expand Up @@ -244,6 +244,15 @@ fn foreign_item_ident(foreign_item: &ForeignItem) -> String {
}

/// Gets foreign mod identifier as the feature cfgs concatenated by `+`
///
/// e.g. for the following declaration:
///
/// ```rust
/// #[cfg(any(feature = "SceCpuForKernel_363_stub", feature = "SceCpuForKernel_stub"))]
/// extern "C" {}
/// ```
///
/// this function returns `SceCpuForKernel_363_stub+SceCpuForKernel_stub`.
fn foreign_mod_ident(foreign_mod: &ItemForeignMod) -> String {
let ident = foreign_mod.attrs.iter().find_map(|attribute| {
if attribute.style != AttrStyle::Outer {
Expand Down
Loading
Loading