add "--gl" option to set WGPU_BACKEND=gl

This commit is contained in:
yuni 2024-04-25 02:37:45 +02:00
parent 8e27525b35
commit 178f6f5d45

View file

@ -35,14 +35,19 @@ use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() > 1 {
if args[1] == "--version" || args[1] == "-v" {
let version = option_env!("CARGO_PKG_VERSION").unwrap();
let name = option_env!("CARGO_PKG_NAME").unwrap();
let homepage = option_env!("CARGO_PKG_HOMEPAGE").unwrap();
println!("{name} {version}");
println!("License: GNU GPL version 3: https://gnu.org/licenses/gpl.html");
println!("{homepage}");
return;
for arg in &args[1..] {
if arg == "--version" || arg == "-v" {
let version = option_env!("CARGO_PKG_VERSION").unwrap();
let name = option_env!("CARGO_PKG_NAME").unwrap();
let homepage = option_env!("CARGO_PKG_HOMEPAGE").unwrap();
println!("{name} {version}");
println!("License: GNU GPL version 3: https://gnu.org/licenses/gpl.html");
println!("{homepage}");
return;
}
else if arg == "--gl" {
env::set_var("WGPU_BACKEND", "gl");
}
}
}
let mut app = App::new();