Skip to content

Build the engine on macOS - #3

Open
HungOm wants to merge 1 commit into
maolan:mainfrom
HungOm:macos-support
Open

Build the engine on macOS#3
HungOm wants to merge 1 commit into
maolan:mainfrom
HungOm:macos-support

Conversation

@HungOm

Copy link
Copy Markdown

PR: Add macOS hardware backend

Adds macOS backend support so the crate builds and runs on macOS.

Adds hw::coreaudio with a placeholder HwDriver that directs users to JACK.
Adds macOS HwWorker integration and shared MIDI/options support.
Enables existing kqueue and macOS pthread handling.
Adds required macOS cfg coverage for hardware MIDI, latency, and ports.
Native CoreAudio/CoreMIDI support remains future work.

Verified: macOS Clippy clean and 344 tests passing.

The crate did not compile for macOS. HwDriver, HwOptions, MidiHub and
HwWorker are imported per target from a backend module -- alsa on Linux, oss
on FreeBSD, sndio on OpenBSD, wasapi on Windows -- but the struct fields and
signatures that use them are not gated, and macOS had no backend, so every
reference was unresolved. discover_midi_hw_devices and
hw_profile_backend_label likewise had an arm per target and no macOS arm,
leaving their bindings undefined.
Add hw::coreaudio as the macOS backend. Maolan has no native CoreAudio
driver yet, so HwDriver::new_with_options reports that and points at JACK,
which hw::jack already provides on any unix; MidiHub and HwOptions are the
shared platform-neutral types the other backends re-export. workers::
coreaudio_worker instantiates the generic HwWorker over it.
Also on macOS:
- MidiInputWaiter's kqueue implementation is shared with FreeBSD and
OpenBSD; macOS has the same kqueue interface, so it applies unchanged.
- pthread_setname_np takes only the name and applies to the calling thread,
unlike the Linux two-argument form and the BSD pthread_set_name_np.
- MIDI endpoints come from CoreMIDI rather than device nodes, so hardware
MIDI discovery returns nothing until a CoreMIDI backend exists.
- hw::latency and hw::ports exist to support a native driver and have no
consumer without one.
Every change is either macOS-only or a cfg widened to include macOS, so no
other target's build changes.
Verified on macOS: clippy --all-targets -D warnings clean, and 344 tests
pass with MAOLAN_PLUGIN_HOST pointing at a locally built plugin host. A
Linux cross-check could not be run here: jack-sys needs pkg-config
configured for cross-compilation.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@HungOm