Regenerate header bindings for the current target instead of reusing incompatible x64 Windows bindings#32
Conversation
| - name: Cargo test | ||
| run: cargo test --workspace |
There was a problem hiding this comment.
Removed this test here as it is already covered by another build step for all targets.
|
|
||
| on: | ||
| push: | ||
| pull_request: |
There was a problem hiding this comment.
Removed the pull_request one as it would trigger our CI jobs twice which isn't needed.
|
The segmentation faults experienced on |
| # - target: armv7-unknown-linux-gnueabihf | ||
| # os: ubuntu-latest | ||
| # name: Linux ARMv7 | ||
| # cross: true | ||
| # test: true |
There was a problem hiding this comment.
Mostly a cross compile issue, not an actual issue with the code so removing the test step for now.
https://github.com/Traverse-Research/cpuinfo-rs/actions/runs/14644308875/job/41094360680
|
The |
Co-authored-by: Marijn Suijten <marijn@traverseresearch.nl>
…nfo-rs into generate-bindings
| let uarch_info = unsafe { cpuinfo_get_uarch(i) }; | ||
| infos.push(unsafe { | ||
| #[cfg(target_arch = "x86_64")] | ||
| #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] |
There was a problem hiding this comment.
@MarijnS95 I've also added the 32 bit targets similarly to how cpuinfo does it.
| infos.push(unsafe { | ||
| #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] | ||
| let cpuid = Some((*uarch_info).cpuid); | ||
| #[cfg(all(not(target_arch = "x86_64"), not(target_arch = "x86")))] |
There was a problem hiding this comment.
Nit: not(any()) makes this more similar (to read/copy-paste) with the above case :)
Co-authored-by: Marijn Suijten <marijn@traverseresearch.nl>
This change removes the pregenerated bindings and instead always generates the bindings at compile time. This results in less work needed to support all targets from
cpuinfo.With bindings being generated at compile time, the cross compilation CI tests now also validate the bindings. Before it would always test against the windows bindings which would "succeed" even though its ABI compared against the compiled
cpuinfostatic library was incorrect. To simplify this CI flow, I've decided to move the cross compilation checks into the generalci.yamlworkflow.I've also patched up our higher level rust code (
lib.rs) to incorporate platform and target specific fields in cpuinfo.h. As a result, this crate now properly supports all targets fromcpuinfo.