// build.rs for rtx-transformers // // When the "cuda" feature is active this build script compiles the // `rope_forward.cu` kernel using NVRTC at *runtime* (via `cudarc`), so there // is no hard build-time dependency on nvcc. The build script only instructs // Cargo to re-run when the kernel source changes. // // If CUDA is not enabled (the default) this build script is a no-op. fn main() { // Only relevant when the cuda feature is active. #[cfg(feature = "cuda")] cuda_setup(); // Always tell Cargo to re-run if *this* script changes. println!("cargo:rerun-if-changed=build.rs"); } #[cfg(feature = "cuda")] fn cuda_setup() { // Track the kernel source so Cargo rebuilds when it changes. println!("cargo:rerun-if-changed=src/cuda_kernels/rope_forward.cu"); // Emit the cuda feature flag for conditional compilation inside the crate. println!("cargo:rustc-cfg=feature=\"cuda\""); }