Make zed2 compile again

Antonio Scandurra created

Change summary

crates/call2/src/participant.rs               |  4 +++
crates/live_kit_client/src/live_kit_client.rs |  1 
crates/live_kit_client/src/prod.rs            | 25 +++++++++++++++++++++
crates/zed2/build.rs                          | 24 ++++++++++++++++++++
4 files changed, 54 insertions(+)

Detailed changes

crates/call2/src/participant.rs 🔗

@@ -56,6 +56,10 @@ pub struct RemoteVideoTrack {
     pub(crate) live_kit_track: Arc<live_kit_client::RemoteVideoTrack>,
 }
 
+unsafe impl Send for RemoteVideoTrack {}
+// todo!("remove this sync because it's not legit")
+unsafe impl Sync for RemoteVideoTrack {}
+
 impl fmt::Debug for RemoteVideoTrack {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         f.debug_struct("RemoteVideoTrack").finish()

crates/live_kit_client/src/prod.rs 🔗

@@ -621,6 +621,9 @@ impl Drop for RoomDelegate {
 }
 
 pub struct LocalAudioTrack(*const c_void);
+unsafe impl Send for LocalAudioTrack {}
+// todo!(Sync is not ok here. We need to remove it)
+unsafe impl Sync for LocalAudioTrack {}
 
 impl LocalAudioTrack {
     pub fn create() -> Self {
@@ -635,6 +638,9 @@ impl Drop for LocalAudioTrack {
 }
 
 pub struct LocalVideoTrack(*const c_void);
+unsafe impl Send for LocalVideoTrack {}
+// todo!(Sync is not ok here. We need to remove it)
+unsafe impl Sync for LocalVideoTrack {}
 
 impl LocalVideoTrack {
     pub fn screen_share_for_display(display: &MacOSDisplay) -> Self {
@@ -649,6 +655,9 @@ impl Drop for LocalVideoTrack {
 }
 
 pub struct LocalTrackPublication(*const c_void);
+unsafe impl Send for LocalTrackPublication {}
+// todo!(Sync is not ok here. We need to remove it)
+unsafe impl Sync for LocalTrackPublication {}
 
 impl LocalTrackPublication {
     pub fn new(native_track_publication: *const c_void) -> Self {
@@ -692,6 +701,10 @@ impl Drop for LocalTrackPublication {
 
 pub struct RemoteTrackPublication(*const c_void);
 
+unsafe impl Send for RemoteTrackPublication {}
+// todo!(Sync is not ok here. We need to remove it)
+unsafe impl Sync for RemoteTrackPublication {}
+
 impl RemoteTrackPublication {
     pub fn new(native_track_publication: *const c_void) -> Self {
         unsafe {
@@ -747,6 +760,10 @@ pub struct RemoteAudioTrack {
     publisher_id: String,
 }
 
+unsafe impl Send for RemoteAudioTrack {}
+// todo!(Sync is not ok here. We need to remove it)
+unsafe impl Sync for RemoteAudioTrack {}
+
 impl RemoteAudioTrack {
     fn new(native_track: *const c_void, sid: Sid, publisher_id: String) -> Self {
         unsafe {
@@ -783,6 +800,10 @@ pub struct RemoteVideoTrack {
     publisher_id: String,
 }
 
+unsafe impl Send for RemoteVideoTrack {}
+// todo!(Sync is not ok here. We need to remove it)
+unsafe impl Sync for RemoteVideoTrack {}
+
 impl RemoteVideoTrack {
     fn new(native_track: *const c_void, sid: Sid, publisher_id: String) -> Self {
         unsafe {
@@ -864,6 +885,10 @@ pub enum RemoteAudioTrackUpdate {
 
 pub struct MacOSDisplay(*const c_void);
 
+unsafe impl Send for MacOSDisplay {}
+// todo!(Sync is not ok here. We need to remove it)
+unsafe impl Sync for MacOSDisplay {}
+
 impl MacOSDisplay {
     fn new(ptr: *const c_void) -> Self {
         unsafe {

crates/zed2/build.rs 🔗

@@ -0,0 +1,24 @@
+fn main() {
+    println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.15.7");
+
+    if let Ok(value) = std::env::var("ZED_PREVIEW_CHANNEL") {
+        println!("cargo:rustc-env=ZED_PREVIEW_CHANNEL={value}");
+    }
+
+    if std::env::var("ZED_BUNDLE").ok().as_deref() == Some("true") {
+        // Find WebRTC.framework in the Frameworks folder when running as part of an application bundle.
+        println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../Frameworks");
+    } else {
+        // Find WebRTC.framework as a sibling of the executable when running outside of an application bundle.
+        println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path");
+    }
+
+    // Weakly link ReplayKit to ensure Zed can be used on macOS 10.15+.
+    println!("cargo:rustc-link-arg=-Wl,-weak_framework,ReplayKit");
+
+    // Seems to be required to enable Swift concurrency
+    println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
+
+    // Register exported Objective-C selectors, protocols, etc
+    println!("cargo:rustc-link-arg=-Wl,-ObjC");
+}