-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.rs
33 lines (29 loc) · 906 Bytes
/
build.rs
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
#[cfg(target_os = "windows")]
fn require_admin() {
// only build the resource for release builds
// as calling rc.exe might be slow
if std::env::var("PROFILE").unwrap() == "release" {
let manifest = r#"
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
"#;
let mut res = winres::WindowsResource::new();
res.set_manifest(manifest);
if let Err(error) = res.compile() {
eprint!("{}", error);
std::process::exit(1);
}
}
}
fn main() {
#[cfg(target_os = "windows")]
require_admin();
slint_build::compile("ui/main-ui.slint").unwrap();
}