Skip to content

Commit

Permalink
Submodule, api_gen rework (#9)
Browse files Browse the repository at this point in the history
* Submodule, api_gen rework

* Renormalize line endings before `git diff`

* ci: Work around `regex` compilation failure in MSRV check

* Cleanup
  • Loading branch information
MarijnS95 authored Jan 29, 2024
1 parent 98f0fe1 commit 6ad60b8
Show file tree
Hide file tree
Showing 3,143 changed files with 6,305 additions and 425,647 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,27 @@ jobs:
- name: Generate minimal-version dependencies
run: cargo -Zminimal-versions generate-lockfile
- uses: dtolnay/[email protected]
- name: Upgrade to [email protected]
# Workaround for:
# https://github.com/rust-lang/regex/issues/931
# https://github.com/rust-lang/rust-bindgen/pull/2714
run: cargo update -p regex --precise 1.5.1
- name: Cargo check
run: cargo check --workspace --all-targets

generate:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Checkout submodule
# Manually update submodules with --checkout because they are configured with update=none and will be skipped otherwise
run: git submodule update --recursive --init --force --checkout
- name: Run generator
run: cargo r -p api_gen
- name: Normalize line endings
run: |
git add --renormalize -u
git reset
- name: Diff autogen result
shell: bash
run: test -z "$(git status --porcelain)" || (echo "::error::Generated files are different, please regenerate with cargo run -p api_gen!"; git diff; false)
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[submodule "ADLX"]
path = vendor/ADLX
url = https://github.com/GPUOpen-LibrariesAndSDKs/ADLX
depth = 1
update = none
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ keywords = ["amd", "adlx", "gpu"]
anyhow = "1.0.79"
libloading = "0.8"

[workspace]
members = [
"api-gen"
]
[workspace]
members = [
"api_gen"
]
17 changes: 0 additions & 17 deletions api-gen/Cargo.toml

This file was deleted.

6,236 changes: 0 additions & 6,236 deletions api-gen/src/adlx/bindings.rs

This file was deleted.

6 changes: 0 additions & 6 deletions api-gen/src/adlx/wrapper.h

This file was deleted.

17 changes: 0 additions & 17 deletions api-gen/src/main.rs

This file was deleted.

8 changes: 8 additions & 0 deletions api_gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "api_gen"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies]
bindgen = "0.69.2"
21 changes: 21 additions & 0 deletions api_gen/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use std::path::Path;

fn main() {
let crate_root = Path::new(env!("CARGO_MANIFEST_DIR"));

let header_path = crate_root.join("wrapper.h");

let bindings = bindgen::Builder::default()
.header(header_path.to_string_lossy())
.clang_arg(format!(
"-I{}",
crate_root.join("../vendor/ADLX/SDK/Include/").display()
))
.allowlist_item("I?ADLX\\w+")
.generate()
.expect("failed to generate adlx bindings");

bindings
.write_to_file(crate_root.join("../src/ffi.rs"))
.expect("Couldn't write bindings!");
}
6 changes: 6 additions & 0 deletions api_gen/wrapper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <ADLX.h>

// Interfaces to generate bindings for
#include <ISystem1.h>
#include <IPerformanceMonitoring.h>
#include <IPerformanceMonitoring1.h>
6,236 changes: 0 additions & 6,236 deletions src/bindings.rs

This file was deleted.

6,240 changes: 6,235 additions & 5 deletions src/ffi.rs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#![doc = include_str!("../README.md")]

#[allow(
non_upper_case_globals,
non_camel_case_types,
non_snake_case,
dead_code
)]
pub mod ffi;

pub mod gpu;
Expand Down
1 change: 1 addition & 0 deletions vendor/ADLX
Submodule ADLX added at d36123
Binary file removed vendor/adlx/ADLX SDK License Agreement.pdf
Binary file not shown.
25 changes: 0 additions & 25 deletions vendor/adlx/README.md

This file was deleted.

175 changes: 0 additions & 175 deletions vendor/adlx/SDK/ADLXHelper/Windows/C/ADLXHelper.c

This file was deleted.

Loading

0 comments on commit 6ad60b8

Please sign in to comment.