use std::borrow::Cow;
pub type CowStr = Cow<'static, str>;
pub const GODOT_VERSION_STRING: &str = "4.4";
#[non_exhaustive]
pub enum TargetPlatform {
Windows,
MacOS,
Linux,
Wasm,
}
pub const fn load_gdextension_header_h() -> CowStr {
CowStr::Borrowed(include_str!("../../4.4/res/gdextension_interface.h"))
}
#[deprecated = "Wrongly dispatches based on host and doesn't support Wasm. Use load_gdextension_header_rs_for_platform() instead."]
pub const fn load_gdextension_header_rs() -> CowStr {
#[cfg(windows)]
let s = include_str!("../../4.4/res/gdextension_interface_windows.rs");
#[cfg(target_os = "macos")]
let s = include_str!("../../4.4/res/gdextension_interface_macos.rs");
#[cfg(all(unix, not(target_os = "macos")))]
let s = include_str!("../../4.4/res/gdextension_interface_linux.rs");
CowStr::Borrowed(s)
}
pub fn load_gdextension_header_rs_for_platform(platform: TargetPlatform) -> CowStr {
let s = match platform {
TargetPlatform::Windows => include_str!("../../4.4/res/gdextension_interface_windows.rs"),
TargetPlatform::MacOS => include_str!("../../4.4/res/gdextension_interface_macos.rs"),
TargetPlatform::Linux => include_str!("../../4.4/res/gdextension_interface_linux.rs"),
TargetPlatform::Wasm => include_str!("../../4.4/res/gdextension_interface_wasm.rs"),
};
CowStr::Borrowed(s)
}
pub const fn load_gdextension_json() -> CowStr {
Cow::Borrowed(include_str!("../res/extension_api.json"))
}
pub fn get_package_property(key: &str) -> Option<CowStr> {
let value = match key {
"godot_version_string" => Cow::Borrowed(GODOT_VERSION_STRING),
"rust_version_string" => Cow::Borrowed("1.93.0"),
"bindgen_version_string" => Cow::Borrowed("0.72.1"),
_ => return None,
};
Some(value)
}