| 8 | |
| 9 | #[cfg(target_os = "macos")] |
| 10 | fn build_avf_bridge() { |
| 11 | println!("cargo:rerun-if-changed=src/backend/macos/bridge.m"); |
| 12 | println!("cargo:rerun-if-changed=src/backend/macos/bridge.h"); |
| 13 | |
| 14 | cc::Build::new() |
| 15 | .file("src/backend/macos/bridge.m") |
| 16 | // Enable Automatic Reference Counting — simplifies ObjC memory management. |
| 17 | .flag("-fobjc-arc") |
| 18 | // Enable Clang modules for AVFoundation/CoreMedia/CoreVideo headers. |
| 19 | .flag("-fmodules") |
| 20 | .compile("avf_bridge"); |
| 21 | |
| 22 | // Link system frameworks required by AVFoundation camera capture. |
| 23 | println!("cargo:rustc-link-lib=framework=AVFoundation"); |
| 24 | println!("cargo:rustc-link-lib=framework=CoreMedia"); |
| 25 | println!("cargo:rustc-link-lib=framework=CoreVideo"); |
| 26 | println!("cargo:rustc-link-lib=framework=Foundation"); |
| 27 | // Accelerate.framework provides vImageScale_ARGB8888 for SIMD-accelerated |
| 28 | // resolution scaling when the hardware delivers at a different resolution |
| 29 | // than the user requested. |
| 30 | println!("cargo:rustc-link-lib=framework=Accelerate"); |
| 31 | } |