Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support and CI tests for BSDs #54

Merged
merged 2 commits into from
Jan 4, 2023
Merged

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Dec 27, 2022

This adds a fallback using shm_open/shm_unlink for platforms where memfd_create doesn't exist. This seems to be how this is normally handled, though it's a bit ugly.

This also builds the wayland/x11 code for NetBSD/OpenBSD/DragonFlyBSD.

Add CI builds for FreeBSD and NetBSD. We would need some kind of virtualisation though to actually run tests on such targets.

I've tested the shm_open logic on Linux, but haven't run it on any BSDs.

@ids1024 ids1024 requested a review from john01dav as a code owner December 27, 2022 21:15
Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why cfg(all(unix, not(target_vendor = "apple"))) wouldn't work for this?

LGTM otherwise

@ids1024
Copy link
Member Author

ids1024 commented Dec 27, 2022

I was thinking the same thing, but thought that could be a problem for Android if/when that's added (#44). And I guess Haiku is cfg(unix) but has its own windowing system and variant in raw-window-handle, if it's ever added.

Annoying that Rust doesn't have a way to define a config option once that could be used everywhere for less repetition.

@notgull
Copy link
Member

notgull commented Dec 27, 2022

We could use cfg_aliases, like the main winit does now.

@ids1024
Copy link
Member Author

ids1024 commented Dec 27, 2022

Updated to cfg_aliases, which is nice though it would be better if cargo offered something like that, and it could also be used for platform-specific dependencies.

It's using all(unix, not(any(target_vendor = "apple", target_os = "android"))), so I guess it should work on Solaris or such too.

src/wayland/buffer.rs Outdated Show resolved Hide resolved
build.rs Outdated Show resolved Hide resolved
src/wayland/buffer.rs Show resolved Hide resolved
src/wayland/buffer.rs Show resolved Hide resolved
This adds a fallback using `shm_open`/`shm_unlink` for platforms where
`memfd_create` doesn't exist. This seems to be how this is normally
handled, though it's a bit ugly.

This also builds the wayland/x11 code for NetBSD/OpenBSD/DragonFlyBSD.

Add CI builds for FreeBSD and NetBSD. We would need some kind of
virtualisation though to actually run tests on such targets.

I've tested the `shm_open` logic on Linux, but haven't run it on any
BSDs.
Copy link
Member

@jackpot51 jackpot51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@jackpot51 jackpot51 merged commit 13853fe into rust-windowing:master Jan 4, 2023
@ids1024 ids1024 deleted the bsd branch August 27, 2023 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants