Skip to content
Merged
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
2 changes: 1 addition & 1 deletion crates/cudnn-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub mod cudnn_sdk;

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

Expand Down
30 changes: 28 additions & 2 deletions crates/cust_raw/build/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
//! # The build script for cust_raw
//! The build script for the cust_raw generates bindings for libraries in the
//! CUDA SDK. The build scripts searches for the CUDA SDK by reading the
//! `CUDA_PATH`, `CUDA_ROOT`, or `CUDA_TOOLKIT_ROOT_DIR` environment variables
//! in that order. If none of these variables are set to a vaild CUDA Toolkit
//! SDK path, the build script will attempt to search for any SDK in the
//! default installation locations for the current platform.
//!
//! ## Bindings
//! You can control which bindings are generated by enabling features in your
//! `Cargo.toml` file. By default, only the CUDA driver API is enabled.
//!
//! ## Cargo metadata
//! The build script emits Cargo metadata that can be used by dependent crates
//! in their build script. You can read this metadata via `DEP_CUDA_*`
//! environment variables. The current list of metadata includes:
//!
//! - `DEP_CUDA_ROOT`: The root directory of the CUDA SDK installation used.
//! - `DEP_CUDA_DRIVER_VERSION`: The version of the CUDA driver API found (e.g: `12080`).
//! - `DEP_CUDA_DRIVER_VERSION_MAJOR`: The major version of the CUDA driver API found.
//! - `DEP_CUDA_DRIVER_VERSION_MINOR`: The minor version of the CUDA driver API found.
//! - `DEP_CUDA_RUNTIME_VERSION`: The version of the CUDA runtime API found.
//! - `DEP_CUDA_INCLUDES`: The include directories for the CUDA SDK, separated by platform-specific path separator.
//! - `DEP_CUDA_NVVM_INCLUDES`: The include directories for NVVM headers, separated by platform-specific path separator.
//!

use std::env;
use std::fs;
use std::path;
Expand Down Expand Up @@ -29,8 +55,8 @@ fn main() {
let metadata_nvvm_include = env::join_paths(sdk.nvvm_include_paths())
.map(|s| s.to_string_lossy().to_string())
.expect("Failed to build metadata for nvvm_include.");
println!("cargo::metadata=cuda_include={}", metadata_cuda_include);
println!("cargo::metadata=nvvm_include={}", metadata_nvvm_include);
println!("cargo::metadata=includes={}", metadata_cuda_include);
println!("cargo::metadata=nvvm_includes={}", metadata_nvvm_include);
// Re-run build script conditions.
println!("cargo::rerun-if-changed=build");
for e in sdk.related_cuda_envs() {
Expand Down
2 changes: 1 addition & 1 deletion crates/optix-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod optix_sdk;
// to a lib and link it in so that we have the initialization and C function logic.
fn main() {
let sdk = optix_sdk::OptiXSdk::new().expect("Cannot create OptiX SDK instance.");
let cuda_include_paths = env::var_os("DEP_CUDA_CUDA_INCLUDE")
let cuda_include_paths = env::var_os("DEP_CUDA_INCLUDES")
.map(|s| env::split_paths(s.as_os_str()).collect::<Vec<_>>())
.expect("Cannot find transitive metadata 'cuda_include' from cust_raw package.");

Expand Down