Skip to content

Commit 0c4cf01

Browse files
jorge-ortegaLegNeato
authored andcommitted
refactor(cust_raw): Update cargo metadata names and add crate docs for the build script.
1 parent 6a6bc90 commit 0c4cf01

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

crates/cudnn-sys/build/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub mod cudnn_sdk;
55

66
fn main() {
77
let sdk = cudnn_sdk::CudnnSdk::new().expect("Cannot create cuDNN SDK instance.");
8-
let cuda_include_paths = env::var_os("DEP_CUDA_CUDA_INCLUDE")
8+
let cuda_include_paths = env::var_os("DEP_CUDA_INCLUDES")
99
.map(|s| env::split_paths(s.as_os_str()).collect::<Vec<_>>())
1010
.expect("Cannot find transitive metadata 'cuda_include' from cust_raw package.");
1111

crates/cust_raw/build/main.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
//! # The build script for cust_raw
2+
//! The build script for the cust_raw generates bindings for libraries in the
3+
//! CUDA SDK. The build scripts searches for the CUDA SDK by reading the
4+
//! `CUDA_PATH`, `CUDA_ROOT`, or `CUDA_TOOLKIT_ROOT_DIR` environment variables
5+
//! in that order. If none of these variables are set to a vaild CUDA Toolkit
6+
//! SDK path, the build script will attempt to search for any SDK in the
7+
//! default installation locations for the current platform.
8+
//!
9+
//! ## Bindings
10+
//! You can control which bindings are generated by enabling features in your
11+
//! `Cargo.toml` file. By default, only the CUDA driver API is enabled.
12+
//!
13+
//! ## Cargo metadata
14+
//! The build script emits Cargo metadata that can be used by dependent crates
15+
//! in their build script. You can read this metadata via `DEP_CUDA_*`
16+
//! environment variables. The current list of metadata includes:
17+
//!
18+
//! - `DEP_CUDA_ROOT`: The root directory of the CUDA SDK installation used.
19+
//! - `DEP_CUDA_DRIVER_VERSION`: The version of the CUDA driver API found (e.g: `12080`).
20+
//! - `DEP_CUDA_DRIVER_VERSION_MAJOR`: The major version of the CUDA driver API found.
21+
//! - `DEP_CUDA_DRIVER_VERSION_MINOR`: The minor version of the CUDA driver API found.
22+
//! - `DEP_CUDA_RUNTIME_VERSION`: The version of the CUDA runtime API found.
23+
//! - `DEP_CUDA_INCLUDES`: The include directories for the CUDA SDK, separated by platform-specific path separator.
24+
//! - `DEP_CUDA_NVVM_INCLUDES`: The include directories for NVVM headers, separated by platform-specific path separator.
25+
//!
26+
127
use std::env;
228
use std::fs;
329
use std::path;
@@ -29,8 +55,8 @@ fn main() {
2955
let metadata_nvvm_include = env::join_paths(sdk.nvvm_include_paths())
3056
.map(|s| s.to_string_lossy().to_string())
3157
.expect("Failed to build metadata for nvvm_include.");
32-
println!("cargo::metadata=cuda_include={}", metadata_cuda_include);
33-
println!("cargo::metadata=nvvm_include={}", metadata_nvvm_include);
58+
println!("cargo::metadata=includes={}", metadata_cuda_include);
59+
println!("cargo::metadata=nvvm_includes={}", metadata_nvvm_include);
3460
// Re-run build script conditions.
3561
println!("cargo::rerun-if-changed=build");
3662
for e in sdk.related_cuda_envs() {

crates/optix-sys/build/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub mod optix_sdk;
1010
// to a lib and link it in so that we have the initialization and C function logic.
1111
fn main() {
1212
let sdk = optix_sdk::OptiXSdk::new().expect("Cannot create OptiX SDK instance.");
13-
let cuda_include_paths = env::var_os("DEP_CUDA_CUDA_INCLUDE")
13+
let cuda_include_paths = env::var_os("DEP_CUDA_INCLUDES")
1414
.map(|s| env::split_paths(s.as_os_str()).collect::<Vec<_>>())
1515
.expect("Cannot find transitive metadata 'cuda_include' from cust_raw package.");
1616

0 commit comments

Comments
 (0)