Skip to content

Commit

Permalink
Use rustc-check-cfg (#3682)
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed May 6, 2024
1 parent 7f8771a commit 16fd2ba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
15 changes: 15 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,19 @@ fn main() {
wayland_platform: { all(feature = "wayland", free_unix, not(redox)) },
orbital_platform: { redox },
}

println!("cargo:rustc-check-cfg=cfg(android_platform)");
println!("cargo:rustc-check-cfg=cfg(web_platform)");
println!("cargo:rustc-check-cfg=cfg(macos_platform)");
println!("cargo:rustc-check-cfg=cfg(ios_platform)");
println!("cargo:rustc-check-cfg=cfg(windows_platform)");
println!("cargo:rustc-check-cfg=cfg(apple)");
println!("cargo:rustc-check-cfg=cfg(free_unix)");
println!("cargo:rustc-check-cfg=cfg(redox)");

println!("cargo:rustc-check-cfg=cfg(x11_platform)");
println!("cargo:rustc-check-cfg=cfg(wayland_platform)");
println!("cargo:rustc-check-cfg=cfg(orbital_platform)");

println!("cargo:rustc-check-cfg=cfg(unreleased_changelogs)");
}
7 changes: 5 additions & 2 deletions src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ impl<T> EventLoopBuilder<T> {
///
/// [`platform`]: crate::platform
#[cfg_attr(
android,
android_platform,
doc = "[`.with_android_app(app)`]: \
crate::platform::android::EventLoopBuilderExtAndroid::with_android_app"
)]
#[cfg_attr(not(android), doc = "[`.with_android_app(app)`]: #only-available-on-android")]
#[cfg_attr(
not(android_platform),
doc = "[`.with_android_app(app)`]: #only-available-on-android"
)]
#[inline]
pub fn build(&mut self) -> Result<EventLoop<T>, EventLoopError> {
let _span = tracing::debug_span!("winit::EventLoopBuilder::build").entered();
Expand Down
4 changes: 2 additions & 2 deletions src/platform/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,10 @@ pub trait WindowAttributesExtWindows {
/// the menus look. If you use this, it is recommended that you combine it with
/// `with_theme(Some(Theme::Light))` to avoid a jarring effect.
#[cfg_attr(
platform_windows,
windows_platform,
doc = "[`CreateMenu`]: windows_sys::Win32::UI::WindowsAndMessaging::CreateMenu"
)]
#[cfg_attr(not(platform_windows), doc = "[`CreateMenu`]: #only-available-on-windows")]
#[cfg_attr(not(windows_platform), doc = "[`CreateMenu`]: #only-available-on-windows")]
fn with_menu(self, menu: HMENU) -> Self;

/// This sets `ICON_BIG`. A good ceiling here is 256x256.
Expand Down

0 comments on commit 16fd2ba

Please sign in to comment.