BlueGit

ict rusty-teams

Files

rusty-teams / vendor / gpui-pre / build.rs

build.rs

build.rs 1.5 KiB Download Raw
1#![allow(clippy::disallowed_methods, reason = "build scripts are exempt")]
2
3fn main() {
4 println!("cargo::rustc-check-cfg=cfg(gles)");
5
6 // Leak detection does bookkeeping on every entity handle, so `test-support`
7 // does not enable it: that feature must stay cheap enough to compile into
8 // every build. CI sets `GPUI_LEAK_DETECTION`; the `leak-detection` feature
9 // turns it on explicitly.
10 println!("cargo::rustc-check-cfg=cfg(gpui_leak_detection)");
11 println!("cargo::rerun-if-env-changed=GPUI_LEAK_DETECTION");
12 let requested_by_environment =
13 std::env::var_os("GPUI_LEAK_DETECTION").is_some_and(|value| !value.is_empty());
14 if requested_by_environment || std::env::var_os("CARGO_FEATURE_LEAK_DETECTION").is_some() {
15 println!("cargo::rustc-cfg=gpui_leak_detection");
16 }
17
18 let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
19
20 if target_os == "windows" {
21 #[cfg(feature = "windows-manifest")]
22 embed_resource();
23 }
24}
25
26#[cfg(feature = "windows-manifest")]
27fn embed_resource() {
28 let resource_dir = std::path::Path::new("resources/windows");
29 let manifest = resource_dir.join("gpui.manifest.xml");
30 let rc_file = resource_dir.join("gpui.rc");
31 println!("cargo:rerun-if-changed={}", manifest.display());
32 println!("cargo:rerun-if-changed={}", rc_file.display());
33 embed_resource::compile(rc_file, embed_resource::ParamsIncludeDirs([resource_dir]))
34 .manifest_required()
35 .unwrap();
36}