Skip to content
Open
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
3 changes: 3 additions & 0 deletions rust/crates/nvtx-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ std = ["widestring/std"]
alloc = ["widestring/alloc"]
cuda = []
cuda_runtime = []
# Expose the NVTX tools/injection ABI (`nvtxDetail/nvtxTypes.h`) for tools
# implementing injection libraries.
tools = []

[lints]
workspace = true
21 changes: 19 additions & 2 deletions rust/crates/nvtx-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,28 @@ fn main() {
// allow cuda types
.allowlist_type("CU.*")
.allowlist_type("cuda.*")
// disallow any fntypes
.blocklist_type(".*fntype.*")
// disallow impl-specific
.blocklist_type("__.*");

if cfg!(feature = "tools") {
builder = builder
// expose the callback-subscription types (export tables, callback
// modules, and callback ids)
.allowlist_type("Nvtx.*")
// expose the dependency-free fake types referenced by the
// fakeimpl fntypes (required because allowlisting is not recursive)
.allowlist_type("nvtx_.*")
// expose the injection result codes
.allowlist_var("NVTX_SUCCESS")
.allowlist_var("NVTX_FAIL")
.allowlist_var("NVTX_ERR_.*");
// the function-table slot signatures (`*_impl_fntype` and
// `*_fakeimpl_fntype`) are covered by the "nvtx[^_].*" allowlist above
} else {
// disallow any fntypes
builder = builder.blocklist_type(".*fntype.*");
}

if cfg!(feature = "cuda") {
builder = builder.clang_arg("-DENABLE_CUDA");
lib_builder.define("ENABLE_CUDA", None);
Expand Down