zoc: Specify output path

This commit is contained in:
Joëlle van Essen 2025-03-27 10:18:11 +01:00
parent 1ce4a40b0f
commit e6e9a79fe7
No known key found for this signature in database
GPG key ID: 28D3B5CDD4B43882
3 changed files with 11 additions and 4 deletions

4
Cargo.lock generated
View file

@ -104,9 +104,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "bpaf"
version = "0.9.18"
version = "0.9.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4de4d74c5891642753c67ab88f58d971a68dd98673b69689a8c24ce3ec78a412"
checksum = "4848ed5727d39a7573551c205bcb1ccd88c8cad4ed2c80f62e2316f208196b8d"
dependencies = [
"bpaf_derive",
]

View file

@ -11,7 +11,7 @@ path = "src/main.rs"
[dependencies]
amd_comgr-sys = { path = "../ext/amd_comgr-sys" }
bpaf = { version = "0.9.18", features = ["derive"] }
bpaf = { version = "0.9.19", features = ["derive"] }
comgr = { path = "../comgr" }
hip_runtime-sys = { path = "../ext/hip_runtime-sys" }
ptx = { path = "../ptx" }

View file

@ -17,6 +17,10 @@ pub struct Options {
#[bpaf(external(output_type), optional)]
output_type: Option<OutputType>,
#[bpaf(short('o'), argument("file"))]
/// Output path
output_path: Option<PathBuf>,
#[bpaf(positional("filename"))]
/// PTX file
ptx_path: String,
@ -30,7 +34,10 @@ fn main() -> Result<(), CompilerError> {
let ptx_path = Path::new(&opts.ptx_path).to_path_buf();
check_path(&ptx_path)?;
let output_path = get_output_path(&ptx_path, &output_type)?;
let output_path = match opts.output_path {
Some(value) => value,
None => get_output_path(&ptx_path, &output_type)?
};
check_path(&output_path)?;
let ptx = fs::read(&ptx_path).map_err(CompilerError::from)?;