Skip to content

Commit

Permalink
Merge pull request #5 from Boddlnagg/other-os
Browse files Browse the repository at this point in the history
Build nothing on non-Apple systems
  • Loading branch information
jonas-k committed Jul 20, 2017
2 parents ef64978 + 0b62a3f commit a2f0fee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "coremidi-sys"
version = "2.0.0"
version = "2.0.2"
authors = ["Jonas Klesy", "Patrick Reisert"]
description = "Low-level FFI bindings for the CoreMIDI framework"
license = "MIT"
repository = "https://github.com/jonas-k/coremidi-sys"
documentation = "https://docs.rs/coremidi-sys"
categories = ["external-ffi-bindings", "multimedia::audio"]

[dependencies]
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
core-foundation-sys = "0.2"

[package.metadata.docs.rs]
Expand Down
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
fn main() {
println!("cargo:rustc-link-lib=framework=CoreMIDI");
if std::env::var("TARGET").expect("cannot read TARGET environment variable").contains("apple") {
println!("cargo:rustc-link-lib=framework=CoreMIDI");
}
}
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(any(target_os = "macos", target_os = "ios"))]

#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types)]

extern crate core_foundation_sys;
Expand All @@ -13,7 +15,7 @@ include!("generated.rs");
pub unsafe fn MIDIPacketNext(pkt: *const MIDIPacket) -> *const MIDIPacket {
let ptr = &(*pkt).data as *const u8;
let offset = (*pkt).length as isize;
if cfg!(target_arch = "arm") {
if cfg!(any(target_arch = "arm", target_arch = "aarch64")) {
// MIDIPacket must be 4-byte aligned on ARM
((ptr.offset(offset + 3) as usize) & !(3usize)) as *const MIDIPacket
} else {
Expand Down

0 comments on commit a2f0fee

Please sign in to comment.