use std::env;
fn main()
{
if env::var("WHY2_DEV_BYPASS").is_ok() { return; }
let client_feature = env::var("CARGO_FEATURE_CLIENT").is_ok();
let server_feature = env::var("CARGO_FEATURE_SERVER").is_ok();
let chat_feature = env::var("CARGO_FEATURE_CHAT").is_ok();
if chat_feature && !(client_feature || server_feature)
{
panic!("Do not enable `chat` directly - use `client` or `server`.");
}
if client_feature && server_feature
{
panic!
(
"Error: You are trying to enable both `client` and `server` features at the same time.\n\
By default, the 'client' feature is enabled.\n\n\
To install the SERVER, use:\n\
cargo install why2-chat --no-default-features --features server"
);
}
let config_dir = env::var("WHY2_CONFIG_DIR").unwrap_or_else(|_| "{HOME}/.config/WHY2".to_string());
println!("cargo:rustc-env=WHY2_CONFIG_DIR={config_dir}");
println!("cargo:rerun-if-env-changed=WHY2_CONFIG_DIR");
}