Skip to content

Commit

Permalink
Add link directives for iOS frameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfairley committed Jul 23, 2017
1 parent 7ebf5fe commit 60f2ef8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions sdl2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,29 @@
extern crate pkg_config;

fn main() {
if !build_pkgconfig() {
let target = ::std::env::var("TARGET").expect("Cargo build scripts always have TARGET");
let target_os = target.splitn(3, "-").nth(2).unwrap();
let target = ::std::env::var("TARGET").expect("Cargo build scripts always have TARGET");
let target_os = target.splitn(3, "-").nth(2).unwrap();

if !build_pkgconfig() {
if cfg!(feature="use_mac_framework") && target_os == "darwin" {
println!("cargo:rustc-flags=-l framework=SDL2");
} else {
println!("cargo:rustc-flags=-l SDL2");
}
}

if target_os == "ios" {
println!("cargo:rustc-flags=-l framework=AVFoundation");
println!("cargo:rustc-flags=-l framework=AudioToolbox");
println!("cargo:rustc-flags=-l framework=CoreAudio");
println!("cargo:rustc-flags=-l framework=CoreGraphics");
println!("cargo:rustc-flags=-l framework=CoreMotion");
println!("cargo:rustc-flags=-l framework=Foundation");
println!("cargo:rustc-flags=-l framework=GameController");
println!("cargo:rustc-flags=-l framework=OpenGLES");
println!("cargo:rustc-flags=-l framework=QuartzCore");
println!("cargo:rustc-flags=-l framework=UIKit");
}
}

#[cfg(not(feature="pkg-config"))]
Expand Down

0 comments on commit 60f2ef8

Please sign in to comment.