1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 19:58:15 +03:00
wezterm/build.rs
Wez Furlong 61e3545c68 pty: windows: allow loading a newer conpty dll
This commit allows loading the console functions from `conpty.dll`
instead of `kernel32.dll` which means that we can update and
track newer features than have been deployed to Windows.

In practical terms this means that we can now unlock mouse input
reporting in eg: VIM running under WSL.
refs: https://github.com/microsoft/terminal/issues/376

We're jumping the gun on this issue, which is tracking making
a proper supportable way to deploy this sort of update:
refs: https://github.com/microsoft/terminal/issues/1130

For now it seems easier just for us to bundle our own copy of
these bits.

This includes a speculative change to include those in our
Windows downloads also.

The binaries were built from
4f8acb4b9f
2020-04-06 12:48:54 -07:00

41 lines
1.4 KiB
Rust

use vergen::{generate_cargo_keys, ConstantsFlags};
fn main() {
let mut flags = ConstantsFlags::all();
flags.remove(ConstantsFlags::SEMVER_FROM_CARGO_PKG);
// Generate the 'cargo:' key output
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
// If a file named `.tag` is present, we'll take its contents for the
// version number that we report in wezterm -h.
let mut ci_tag = String::new();
if let Ok(tag) = std::fs::read(".tag") {
if let Ok(s) = String::from_utf8(tag) {
ci_tag = s.trim().to_string();
println!("cargo:rerun-if-changed=.tag");
}
}
println!("cargo:rustc-env=WEZTERM_CI_TAG={}", ci_tag);
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.9");
#[cfg(windows)]
{
use std::path::Path;
let profile = std::env::var("PROFILE").unwrap();
let exe_output_dir = Path::new("target").join(profile);
let exe_src_dir = Path::new("assets/windows/conhost");
for name in &["conpty.dll", "OpenConsole.exe"] {
let dest_name = exe_output_dir.join(name);
let src_name = exe_src_dir.join(name);
if !dest_name.exists() {
std::fs::copy(src_name, dest_name).unwrap();
}
}
}
#[cfg(windows)]
embed_resource::compile("assets/windows/resource.rc");
}