Skip to content

Commit

Permalink
Link necessary mac os frameworks on mac os target
Browse files Browse the repository at this point in the history
  • Loading branch information
crumblingstatue committed Oct 18, 2024
1 parent 415c744 commit 904ec33
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ fn main() {
let is_linux = env::var("CARGO_CFG_TARGET_OS")
.map(|os| os == "linux")
.unwrap_or(false);
let is_macos = env::var("CARGO_CFG_TARGET_OS")
.map(|os| os == "macos")
.unwrap_or(false);
if is_macos {
link_mac_os_frameworks();
}
let link_search = if matches!(win_env, Some(WinEnv::Msvc)) {
"build/lib/Release"
} else {
Expand Down Expand Up @@ -285,3 +291,11 @@ fn main() {
fn link_sfml_subsystem(name: &str) {
println!("cargo:rustc-link-lib=static=sfml-{name}-s");
}

fn link_mac_os_frameworks() {
println!("cargo:rustc-link-lib=framework=CoreFoundation");
println!("cargo:rustc-link-lib=framework=CoreGraphics");
println!("cargo:rustc-link-lib=framework=IOKit");
println!("cargo:rustc-link-lib=framework=Carbon");
println!("cargo:rustc-link-lib=framework=AppKit");
}

0 comments on commit 904ec33

Please sign in to comment.