From eeadb335678a637014f581f7930082c354c22a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Fri, 22 Sep 2023 16:31:50 -0700 Subject: [PATCH] wip --- README.md | 3 +++ livekit-ffi/build.rs | 4 ++++ webrtc-sys/build.rs | 42 +++++++++++++++++++++++------------------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0a9765b4..54864210 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ Use this SDK to add real-time video, audio and data features to your Rust app. By connecting to a self- or cloud-hosted LiveKit server, you can quickly build applications like interactive live streaming or video calls with just a few lines of code. [![crates.io](https://img.shields.io/crates/v/livekit.svg)](https://crates.io/crates/livekit) +[![livekit docs.rs](https://img.shields.io/docsrs/livekit)](https://docs.rs/livekit/latest/) +[![livekit-api docs.rs](https://img.shields.io/docsrs/livekit-api)](https://docs.rs/livekit-api/latest/) +[![livekit-webrtc docs.rs](https://img.shields.io/docsrs/livekit-webrtc)](https://docs.rs/livekit-webrtc/latest/) [![Builds](https://github.com/livekit/client-sdk-native/actions/workflows/builds.yml/badge.svg?branch=main)](https://github.com/livekit/client-sdk-native/actions/workflows/builds.yml) [![Tests](https://github.com/livekit/client-sdk-native/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/livekit/client-sdk-native/actions/workflows/tests.yml) diff --git a/livekit-ffi/build.rs b/livekit-ffi/build.rs index c04601a7..9db1985b 100644 --- a/livekit-ffi/build.rs +++ b/livekit-ffi/build.rs @@ -15,6 +15,10 @@ use std::env; fn main() { + if env::var("DOCS_RS").is_ok() { + return; + } + if env::var("CARGO_CFG_TARGET_OS").unwrap() == "android" { webrtc_sys_build::configure_jni_symbols().unwrap(); } diff --git a/webrtc-sys/build.rs b/webrtc-sys/build.rs index 36af11c6..a76ca01b 100644 --- a/webrtc-sys/build.rs +++ b/webrtc-sys/build.rs @@ -17,17 +17,13 @@ use std::path; use std::process::Command; fn main() { + if env::var("DOCS_RS").is_ok() { + return; + } + println!("cargo:rerun-if-env-changed=LK_DEBUG_WEBRTC"); println!("cargo:rerun-if-env-changed=LK_CUSTOM_WEBRTC"); - let webrtc_dir = webrtc_sys_build::webrtc_dir(); - let webrtc_include = webrtc_dir.join("include"); - let webrtc_lib = webrtc_dir.join("lib"); - - if !webrtc_dir.exists() { - webrtc_sys_build::download_webrtc().unwrap(); - } - let mut builder = cxx_build::bridges([ "src/peer_connection.rs", "src/peer_connection_factory.rs", @@ -53,17 +49,6 @@ fn main() { "src/android.rs", ]); - builder.includes(&[ - path::PathBuf::from("./include"), - webrtc_include.clone(), - webrtc_include.join("third_party/abseil-cpp/"), - webrtc_include.join("third_party/libyuv/include/"), - webrtc_include.join("third_party/libc++/"), - // For mac & ios - webrtc_include.join("sdk/objc"), - webrtc_include.join("sdk/objc/base"), - ]); - builder.files(&[ "src/peer_connection.cpp", "src/peer_connection_factory.cpp", @@ -89,6 +74,25 @@ fn main() { "src/frame_cryptor.cpp", ]); + let webrtc_dir = webrtc_sys_build::webrtc_dir(); + let webrtc_include = webrtc_dir.join("include"); + let webrtc_lib = webrtc_dir.join("lib"); + + if !webrtc_dir.exists() { + webrtc_sys_build::download_webrtc().unwrap(); + } + + builder.includes(&[ + path::PathBuf::from("./include"), + webrtc_include.clone(), + webrtc_include.join("third_party/abseil-cpp/"), + webrtc_include.join("third_party/libyuv/include/"), + webrtc_include.join("third_party/libc++/"), + // For mac & ios + webrtc_include.join("sdk/objc"), + webrtc_include.join("sdk/objc/base"), + ]); + println!( "cargo:rustc-link-search=native={}", webrtc_lib.to_str().unwrap()