-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marc-André Moreau
committed
Aug 21, 2024
1 parent
8fa56c7
commit cd840e3
Showing
7 changed files
with
111 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
crates/devolutions-pedm-contextmenu/devolutions-pedm-contextmenu-shell/build.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
fn main() { | ||
#[cfg(target_os = "windows")] | ||
win::embed_version_rc(); | ||
} | ||
|
||
#[cfg(target_os = "windows")] | ||
mod win { | ||
use std::{env, fs}; | ||
|
||
pub(super) fn embed_version_rc() { | ||
let out_dir = env::var("OUT_DIR").unwrap(); | ||
let version_rc_file = format!("{}/version.rc", out_dir); | ||
let version_rc_data = generate_version_rc(); | ||
fs::write(&version_rc_file, version_rc_data).unwrap(); | ||
|
||
embed_resource::compile(&version_rc_file, embed_resource::NONE); | ||
embed_resource::compile("resources.rc", embed_resource::NONE); | ||
} | ||
|
||
fn generate_version_rc() -> String { | ||
let output_name = "devolutions-pedm-contextmenu"; | ||
let filename = format!("{}.exe", output_name); | ||
let company_name = "Devolutions Inc."; | ||
let legal_copyright = format!("Copyright 2020-2024 {}", company_name); | ||
|
||
let version_number = env::var("CARGO_PKG_VERSION").unwrap() + ".0"; | ||
let version_commas = version_number.replace('.', ","); | ||
let file_description = output_name; | ||
let file_version = version_number.clone(); | ||
let internal_name = filename.clone(); | ||
let original_filename = filename; | ||
let product_name = output_name; | ||
let product_version = version_number; | ||
let vs_file_version = version_commas.clone(); | ||
let vs_product_version = version_commas; | ||
|
||
let version_rc = format!( | ||
r#"#include <winresrc.h> | ||
VS_VERSION_INFO VERSIONINFO | ||
FILEVERSION {vs_file_version} | ||
PRODUCTVERSION {vs_product_version} | ||
FILEFLAGSMASK 0x3fL | ||
#ifdef _DEBUG | ||
FILEFLAGS 0x1L | ||
#else | ||
FILEFLAGS 0x0L | ||
#endif | ||
FILEOS 0x40004L | ||
FILETYPE 0x1L | ||
FILESUBTYPE 0x0L | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "040904b0" | ||
BEGIN | ||
VALUE "CompanyName", "{company_name}" | ||
VALUE "FileDescription", "{file_description}" | ||
VALUE "FileVersion", "{file_version}" | ||
VALUE "InternalName", "{internal_name}" | ||
VALUE "LegalCopyright", "{legal_copyright}" | ||
VALUE "OriginalFilename", "{original_filename}" | ||
VALUE "ProductName", "{product_name}" | ||
VALUE "ProductVersion", "{product_version}" | ||
END | ||
END | ||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x409, 1200 | ||
END | ||
END"#, | ||
vs_file_version = vs_file_version, | ||
vs_product_version = vs_product_version, | ||
company_name = company_name, | ||
file_description = file_description, | ||
file_version = file_version, | ||
internal_name = internal_name, | ||
legal_copyright = legal_copyright, | ||
original_filename = original_filename, | ||
product_name = product_name, | ||
product_version = product_version | ||
); | ||
|
||
version_rc | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
crates/devolutions-pedm-contextmenu/devolutions-pedm-contextmenu-shell/resources.rc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
101 ICON "../../../package/AgentWindowsManaged/Resources/DevolutionsAgent.ico" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
101 ICON "../package/AgentWindowsManaged/Resources/DevolutionsAgent.ico" |