build.rs

 1fn main() {
 2    println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.15.7");
 3
 4    if let Ok(value) = std::env::var("ZED_MIXPANEL_TOKEN") {
 5        println!("cargo:rustc-env=ZED_MIXPANEL_TOKEN={value}");
 6    }
 7    if let Ok(value) = std::env::var("ZED_PREVIEW_CHANNEL") {
 8        println!("cargo:rustc-env=ZED_PREVIEW_CHANNEL={value}");
 9    }
10
11    if std::env::var("ZED_BUNDLE").ok().as_deref() == Some("true") {
12        // Find WebRTC.framework in the Frameworks folder when running as part of an application bundle.
13        println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../Frameworks");
14    } else {
15        // Find WebRTC.framework as a sibling of the executable when running outside of an application bundle.
16        println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path");
17    }
18
19    // Weakly link ReplayKit to ensure Zed can be used on macOS 10.15+.
20    println!("cargo:rustc-link-arg=-Wl,-weak_framework,ReplayKit");
21
22    // Seems to be required to enable Swift concurrency
23    println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
24
25    // Register exported Objective-C selectors, protocols, etc
26    println!("cargo:rustc-link-arg=-Wl,-ObjC");
27}