-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.rs
43 lines (34 loc) · 1.37 KB
/
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
34
35
36
37
38
39
40
41
42
43
include!("src/commands/update/parse.rs");
#[cfg(all(windows, not(debug_assertions)))]
fn main() {
use chrono::Datelike;
use winapi::um::winnt::{LANG_ENGLISH, MAKELANGID, SUBLANG_ENGLISH_US};
use winres::VersionInfo::PRODUCTVERSION;
use winres::WindowsResource;
// add the resource to the executable
let mut resource = WindowsResource::new();
let current_year = chrono::Utc::now().year();
resource.set("LegalCopyright", &format!("© 2020-{current_year} Hop, Inc"));
resource.set("CompanyName", "Hop, Inc");
resource.set("FileDescription", "Hop CLI");
resource.set("InternalName", "Hop CLI");
resource.set("OriginalFilename", "hop.exe");
resource.set_icon("build/windows/resources/hop.ico");
resource.set_language(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
// write the version to the resource
let (major, minor, patch, release) = version(env!("CARGO_PKG_VERSION")).unwrap();
resource.set_version_info(
PRODUCTVERSION,
(major as u64) << 48
| (minor as u64) << 32
| (patch as u64) << 16
| (release.unwrap_or(0) as u64 + 1),
);
// compile the resource file
resource.compile().unwrap();
// fix VCRUNTIME140.dll
static_vcruntime::metabuild();
}
// no need to add for non windows or debug builds
#[cfg(any(not(windows), debug_assertions))]
fn main() {}