-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.rs
More file actions
48 lines (37 loc) · 1.37 KB
/
Copy pathbuild.rs
File metadata and controls
48 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use htwv;
use std::process::Command;
#[cfg(target_os = "windows")]
fn main() {
println!("cargo:rerun-if-changed=shaders");
if std::env::var("CARGO_FEATURE_BUILD_DATA").is_ok() {
let pmbuild = "hotline-data\\pmbuild.cmd";
let status = Command::new("cmd")
.args(["/C", pmbuild, "win32-data"])
.status()
.unwrap_or_else(|e| panic!("failed to run '{pmbuild}': {e}"));
if !status.success() {
panic!("pmbuild win32-data failed with status: {status}");
}
}
}
#[cfg(target_os = "macos")]
fn main() {
use std::path::Path;
println!("cargo:rerun-if-changed=shaders");
if std::env::var("CARGO_FEATURE_BUILD_DATA").is_ok() {
let output_dir = Path::new("target/data/shaders");
let pmbuild = "pmbuild";
let status = Command::new(pmbuild)
.args(["mac-data"])
.status()
.unwrap_or_else(|e| panic!("failed to run '{pmbuild}': {e}"));
if !status.success() {
panic!("pmbuild mac-data failed with status: {status}");
}
println!("cargo:warning=Compiling shaders...");
match htwv::compile_dir("shaders", "target/data/shaders") {
Ok(_) => println!("cargo:warning=Shader compilation succeeded"),
Err(e) => println!("cargo:warning=Shader compilation errors:\n{e}"),
}
}
}