use std::path::Path; use std::process::Command; fn main() { // Path to your Python script let python_script = "src/python/kernel.py"; let python_executable = if Path::new(".venv").exists() { if cfg!(windows) { ".venv\\Scripts\\python.exe" } else { ".venv/bin/python" } } else { "python" }; // Run the Python script let status = Command::new(python_executable) .arg(python_script) .status() .expect("Failed to execute Python script"); if !status.success() { panic!("CUDA kernel compilation failed"); } // Rerun the PTX generation script if it has changed println!("cargo:rerun-if-changed=src/kernel.py"); }