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

Generate bindings with build.rs at compile time #26

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

ian-h-chamberlain
Copy link
Member

Thanks to @FenrirWolf for doing a bunch of awesome work in rust3ds/ctru-rs#133 which paved the way for this PR! (I basically just copy-pasted their implementation of the cc compile steps)

Effectively:

  • Move the existing bindgen script into build.rs
  • In lib.rs, include the file generated at build time
  • Compile inline statics with devkitARM toolchain
  • Remove now-unneeded reimplementations of inline statics
  • Use doxygen_rs to clean up the docs of the generated bindings.

This cleans up the repo a lot and also ensures we are using the
canonical implementations of those inline functions, which should help
prevent mistakes in those as well.


Also, in #25 I forgot to hook up the test_runner::run_gdb itself, so that should be fixed now. We didn't have any tests for it to matter yet so no biggie.

Effectively:
- Move the previous bindgen script into build.rs
- In lib.rs, include the file generated at build time
- Compile inline statics with devkitARM toolchain
- Remove now-unneeded reimplementations of inline statics
- Use doxygen_rs to clean up the docs of the generated bindings.

Nice! This cleans up the repo a lot and also ensures we are using the
canonical implementations of those inline functions, which should help
prevent mistakes as well.
@ian-h-chamberlain ian-h-chamberlain requested review from a team, AzureMarker and Meziu October 1, 2023 03:05
Assume devkitARM ships with only a single version, so then find the
first entry matching `${DEVKITARM}/lib/gcc/arm-none-eabi/*/include` and add it
to the -isystem includes.
Copy link
Member

@Meziu Meziu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes made by Fenrir for ctru-rs were very nice indeed, and this PR look like a direct port of that. LGTM.

@ian-h-chamberlain ian-h-chamberlain merged commit 96b2c18 into main Oct 5, 2023
4 checks passed
@ian-h-chamberlain ian-h-chamberlain deleted the feature/build-script-bindgen branch October 5, 2023 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants