2020-07-21 03:50:53 +00:00
|
|
|
use std::env;
|
2023-05-22 19:31:08 +00:00
|
|
|
use std::error::Error;
|
|
|
|
use vergen::EmitBuilder;
|
2020-07-21 03:50:53 +00:00
|
|
|
|
2023-05-22 19:31:08 +00:00
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
|
|
// Emit version info, and "rerun-if-changed" for relevant files, including build.rs
|
|
|
|
EmitBuilder::builder()
|
2023-05-22 20:13:50 +00:00
|
|
|
.build_timestamp()
|
|
|
|
.cargo_features()
|
|
|
|
.git_sha(false)
|
|
|
|
.git_commit_timestamp()
|
|
|
|
.git_commit_date()
|
2023-05-22 19:31:08 +00:00
|
|
|
.emit()?;
|
2020-07-21 03:50:53 +00:00
|
|
|
|
2021-01-24 22:48:47 +00:00
|
|
|
// Embed resource file w/ icon on windows
|
|
|
|
// To allow for cross-compilation, this must not be behind cfg(windows)!
|
|
|
|
println!("cargo:rerun-if-changed=assets/ruffle_desktop.rc");
|
2023-04-03 02:39:11 +00:00
|
|
|
embed_resource::compile("assets/ruffle_desktop.rc", embed_resource::NONE);
|
2020-07-21 03:50:53 +00:00
|
|
|
|
|
|
|
println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL");
|
2023-05-22 19:31:08 +00:00
|
|
|
let channel = channel();
|
|
|
|
if channel == "nightly" || channel == "dev" {
|
2020-07-21 03:50:53 +00:00
|
|
|
println!("cargo:rustc-cfg=nightly");
|
|
|
|
}
|
2023-05-22 19:31:08 +00:00
|
|
|
println!("cargo:rustc-env=CFG_RELEASE_CHANNEL={channel}");
|
2020-07-21 03:50:53 +00:00
|
|
|
|
2023-05-31 04:47:14 +00:00
|
|
|
// Some SWFS have a large amount of recursion (particularly
|
|
|
|
// around `goto`s). Increase the stack size on Windows
|
|
|
|
// accommodate this (the default on Linux is high enough). We
|
|
|
|
// do the same thing for wasm in web/build.rs.
|
|
|
|
if std::env::var("TARGET").unwrap().contains("windows") {
|
2023-06-27 08:39:19 +00:00
|
|
|
if std::env::var("TARGET").unwrap().contains("msvc") {
|
|
|
|
println!("cargo:rustc-link-arg=/STACK:4000000");
|
2023-06-27 08:42:14 +00:00
|
|
|
} else {
|
2023-06-27 08:39:19 +00:00
|
|
|
println!("cargo:rustc-link-arg=-Xlinker");
|
|
|
|
println!("cargo:rustc-link-arg=--stack");
|
|
|
|
println!("cargo:rustc-link-arg=4000000");
|
|
|
|
}
|
2023-05-31 04:47:14 +00:00
|
|
|
}
|
|
|
|
|
2023-05-22 19:31:08 +00:00
|
|
|
Ok(())
|
2020-07-21 03:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn channel() -> String {
|
|
|
|
if let Ok(channel) = env::var("CFG_RELEASE_CHANNEL") {
|
|
|
|
channel
|
|
|
|
} else {
|
|
|
|
"nightly".to_owned()
|
|
|
|
}
|
|
|
|
}
|