-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.rs
More file actions
32 lines (29 loc) · 1.55 KB
/
Copy pathbuild.rs
File metadata and controls
32 lines (29 loc) · 1.55 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
//! Build script: compile the Slint UI for `arcthumb-config.exe` and
//! embed a Windows resource file containing the app manifest + icon.
//!
//! The manifest declares Per-Monitor DPI v2 and Common Controls v6
//! so `arcthumb-config.exe` scales correctly on mixed-DPI setups and
//! picks up the modern visual style.
//!
//! Cargo links the compiled `.res` into every output artifact, so
//! `arcthumb.dll` also carries the manifest. This is harmless —
//! the shell extension DLL ignores its own manifest.
fn main() {
// Only rerun when the resources change.
println!("cargo:rerun-if-changed=resources/arcthumb-config.rc");
println!("cargo:rerun-if-changed=resources/arcthumb-config.manifest");
println!("cargo:rerun-if-changed=assets/icon.ico");
println!("cargo:rerun-if-changed=ui/main.slint");
// On non-Windows targets this is a no-op so `cargo check` on
// other platforms still works. The manifest is mandatory (it
// declares DPI awareness and Common Controls v6), so treat a
// missing RC compiler or a failed compile as a hard build error
// rather than silently shipping a binary without it.
#[cfg(target_os = "windows")]
embed_resource::compile("resources/arcthumb-config.rc", embed_resource::NONE)
.manifest_required()
.expect("failed to embed Windows resource (manifest + icon)");
// Compile the Slint UI for arcthumb-config. Generated Rust code
// lands in OUT_DIR and is pulled in by `slint::include_modules!()`.
slint_build::compile("ui/main.slint").expect("failed to compile Slint UI");
}