You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
743 B

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");
}