2019-03-24 09:45:14 +03:00
|
|
|
use vergen::{generate_cargo_keys, ConstantsFlags};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut flags = ConstantsFlags::all();
|
2019-12-24 19:28:22 +03:00
|
|
|
flags.remove(ConstantsFlags::SEMVER_FROM_CARGO_PKG);
|
2019-03-24 09:45:14 +03:00
|
|
|
// Generate the 'cargo:' key output
|
|
|
|
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
|
2019-03-25 05:06:03 +03:00
|
|
|
|
2019-12-24 19:28:22 +03:00
|
|
|
// 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);
|
2020-01-24 20:23:49 +03:00
|
|
|
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.9");
|
2019-12-24 19:28:22 +03:00
|
|
|
|
2020-04-06 22:39:35 +03:00
|
|
|
#[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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-25 05:06:03 +03:00
|
|
|
#[cfg(windows)]
|
|
|
|
embed_resource::compile("assets/windows/resource.rc");
|
2019-03-24 09:45:14 +03:00
|
|
|
}
|