-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make binding generation an optinal feature Use --features=bindgen * Introduce api-gen crate * Remove placeholder code from api-gen/lib.rs * Add ADLX as submodule * Remove checked in SDK files * Fix wrapper.h * Move ADLX to vendor/ * Submodule, api_gen rework (#9) * Submodule, api_gen rework * Renormalize line endings before `git diff` * ci: Work around `regex` compilation failure in MSRV check * Cleanup * Fix clippy error * Revert crate name back to adlx * Fix error in example --------- Co-authored-by: Marijn Suijten <[email protected]>
- Loading branch information
1 parent
7e2e970
commit d02e393
Showing
52 changed files
with
6,317 additions
and
25,528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[submodule "ADLX"] | ||
path = vendor/ADLX | ||
url = https://github.com/GPUOpen-LibrariesAndSDKs/ADLX | ||
depth = 1 | ||
update = none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.