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

OSX support #15

Closed
bvssvni opened this issue Jan 20, 2015 · 6 comments

Comments

@bvssvni
Copy link

commented Jan 20, 2015

Are there plans for OSX support?

@tomaka

This comment has been minimized.

Copy link
Collaborator

commented Jan 20, 2015

Just like glutin, that would be great but I can't do it myself since I don't have any mac :-/

@bvssvni

This comment has been minimized.

Copy link
Author

commented Jan 20, 2015

I would like to help, but I'm clueless about where to start. Will post resources here if I come across something.

Perhaps a post in r/rust_gamedev could bring attention from somebody who knows how to do it?

@tomaka

This comment has been minimized.

Copy link
Collaborator

commented Jan 22, 2015

For those that may be coming here from reddit.

To write an implementation, just copy-paste null/mod.rs to <name_of_the_api>/mod.rs, and adjust the header in lib.rs.

The Buffer struct is how data is being submitted to the backend. If the underlying API gives you a pointer to a buffer, make Buffer::get_buffer return it.
If however the API has a function to add data (like ALSA), make Buffer::get_buffer return a Vec and call that function in Buffer::finish.

@mitchmindtree

This comment has been minimized.

Copy link
Member

commented Feb 5, 2015

I'm currently having a go at getting this working! I seem to have successfully compiled some generated bindings for Apple's Core Audio API and I'm about to get to work on the core_audio/mod.rs.

One thing I've noticed is that #[cfg(unix)] seems to trigger os x as well - by default when doing a cargo build on my mac it will try to find the mod cpal_impl in the alsa/mod.rs (rather than the null/mod.rs) - is that expected behaviour? What cfg do I write to help the compiler distinguish between building on mac and on linux (I've not yet had any experience writing platform specific stuff)?

@mitchmindtree

This comment has been minimized.

Copy link
Member

commented Feb 5, 2015

Hmm it seems to work if I change #[cfg(unix)] to #[cfg(target_os = "linux")] and use the following for the os x support:

#[cfg(target_os = "macos")]
#[path="core_audio/mod.rs"]
mod cpal_impl;
@tomaka

This comment has been minimized.

Copy link
Collaborator

commented Feb 5, 2015

I'm currently having a go at getting this working!

Wow, thanks! \o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.