fn main() {
let protoc = protoc_bin_vendored::protoc_bin_path()
.expect("protoc-bin-vendored: no binary for this target");
unsafe {
std::env::set_var("PROTOC", protoc);
}
prost_build::Config::new()
.compile_protos(&["proto/coreml.proto"], &["proto"])
.expect("prost-build: compile_protos failed");
println!("cargo:rerun-if-changed=proto/coreml.proto");
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
let is_apple = matches!(target_os.as_str(), "macos" | "ios");
if is_apple {
cc::Build::new()
.file("csrc/coreml_shim.m")
.flag("-fobjc-arc")
.flag("-fmodules")
.compile("rlx_coreml_shim");
println!("cargo:rerun-if-changed=csrc/coreml_shim.m");
println!("cargo:rerun-if-changed=csrc/coreml_shim.h");
println!("cargo:rustc-link-lib=framework=CoreML");
println!("cargo:rustc-link-lib=framework=Foundation");
}
}