gupaxx/build.rs
hinto-janaiyo 4da775667b
windows/pty: include static [VCRUNTIME140.dll], change PTY size
Bare metal windows was complaining about this DLL, so it is now
included statically using [https://docs.rs/static_vcruntime/].
I tried statically linking everything for Windows but:
	1. It's not necessary, pretty much all DLLs needed
	   (except this one) are included in Windows 7+ by default
	2. It's a pain in the ass to build everything
	   statically, especially since Gupax needs OpenSSL.
	   (building OpenSSL on Windows == hell)

Windows/macOS were having console artifacts, escape codes and
random newlines would show up in P2Pool/XMRig output. After
thinking about it for a while, I realized I left the PTY
size to the default [24 rows/80 columns], hence the PTYs
prematurely inserting newlines and weird escape codes.

It works fine after setting it to [100/1000]. Interestingly,
Linux worked completely fine on 24/80, probably resizes internally.
2022-12-10 15:40:32 -05:00

30 lines
1.1 KiB
Rust
Executable file

// This [build.rs] is for setting Windows icons.
// The icon in [File Explorer] gets set here.
// The icon in the taskbar and top of the App window gets
// set in [src/main.rs, src/constants.rs] at runtime with
// pre-compiled bytes using [include_bytes!()] on the images in [images/].
#[cfg(windows)]
fn main() -> std::io::Result<()> {
static_vcruntime::metabuild();
let mut res = winres::WindowsResource::new();
// This sets the icon.
res.set_icon("images/icons/icon.ico");
// This sets the [Run as Administrator] metadata flag for Windows.
// Why do I do this?: [https://github.com/hinto-janaiyo/gupax/tree/main/src#why-does-gupax-need-to-be-admin-on-windows]
// TL;DR: Because Windows.
res.set_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>
"#);
res.compile()
}
#[cfg(unix)]
fn main() {}