zola/build.rs

36 lines
1.1 KiB
Rust
Raw Normal View History

2018-01-12 23:10:19 +00:00
// use clap::Shell;
2017-07-15 04:24:31 +00:00
include!("src/cli.rs");
fn generate_pe_header() {
use time::OffsetDateTime;
let today = OffsetDateTime::now_utc();
let copyright = format!("Copyright © 2017-{} Vincent Prouillet", today.year());
let mut res = winres::WindowsResource::new();
// needed for MinGW cross-compiling
if cfg!(unix) {
res.set_windres_path("x86_64-w64-mingw32-windres");
}
res.set_icon("docs/static/favicon.ico");
res.set("LegalCopyright", &copyright);
res.compile().expect("Failed to compile Windows resources!");
}
2017-07-15 04:24:31 +00:00
fn main() {
// disabled below as it fails in CI
2018-10-31 07:18:57 +00:00
// let mut app = build_cli();
// app.gen_completions("zola", Shell::Bash, "completions/");
// app.gen_completions("zola", Shell::Fish, "completions/");
// app.gen_completions("zola", Shell::Zsh, "completions/");
// app.gen_completions("zola", Shell::PowerShell, "completions/");
if std::env::var("CARGO_CFG_TARGET_OS").unwrap() != "windows"
&& std::env::var("PROFILE").unwrap() != "release"
{
return;
}
if cfg!(windows){
generate_pe_header();
}
2017-07-15 04:24:31 +00:00
}