advotracker_client: update windows resource handling

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2021-11-12 15:53:33 +01:00
parent ba76d87785
commit 0b5e222318
4 changed files with 86 additions and 63 deletions

View File

@@ -5,20 +5,19 @@
* SPDX-License-Identifier: (0BSD or MIT)
*/
use std::env;
use std::error::Error;
#[cfg(target_os = "windows")]
use twine::build_translations;
//#[cfg(windows)]
use windres::Build;
fn main() -> Result<(), Box<dyn Error>> {
if env::var("CARGO_CFG_TARGET_FAMILY")? == "windows" {
let mut res = Build::new();
let target_env = std::env::var("CARGO_CFG_TARGET_ENV")?;
match target_env.as_str() {
"gnu" => res.set_icon("advotracker.rc"),
"msvc" => res.set_icon("advotracker.rc"),
_ => panic!("Unsupported env: {}", target_env),
};
res.compile()?
}
println!("cargo: rerun-if-changed=build.rs");
build_translations(&["./src/i18n/localization.ini"], "i18n.rs").unwrap();
println!("cargo: compile windows ressource");
//#[cfg(windows)]
Build::new().compile("advotracker.rc").unwrap();
Ok(())
}