Files
client/native/build.rs
T
omar 57807c184e Integrate and verify the native Windows desktop client
- Update pinned Rust, Slint, DSP and WebRTC dependencies, preserving the local vendor patches and source receipts.
- Fix desktop audio scheduling and disconnect handling; include isolated duplex, identity, bookmark and notification checks.
- Record measured differences from TeamSpeak 6.0.0.5232; full visual and server-feature parity remain open.
2026-11-26 16:59:05 +03:00

109 lines
5.2 KiB
Rust

fn main() {
println!("cargo:rustc-env=TEAMSPEACH_BUILD_TARGET={}", std::env::var("TARGET").expect("target triple"));
build_platform();
if std::env::var_os("CARGO_FEATURE_TEST_HARNESS").is_some()
&& matches!(std::env::var("CARGO_CFG_TARGET_OS").as_deref(), Ok(os) if !matches!(os, "android" | "ios"))
{
let config = slint_build::CompilerConfiguration::new().with_debug_info(true);
slint_build::compile_with_config("ui/app.slint", config).expect("compile native interface");
} else {
slint_build::compile("ui/app.slint").expect("compile native interface");
}
if std::env::var_os("CARGO_FEATURE_WEBRTC").is_some() {
build_camera();
build_mobile_capture();
}
}
fn build_camera() {
let os = std::env::var("CARGO_CFG_TARGET_OS").expect("target OS");
let source = match os.as_str() {
"windows" => "src/platform/camera/windows.cpp",
"linux" => "src/platform/camera/linux.cpp",
"macos" | "ios" => "src/platform/camera/apple.mm",
_ => return,
};
println!("cargo:rerun-if-changed={source}");
println!("cargo:rerun-if-changed=src/platform/camera/camera.h");
let mut camera = cc::Build::new();
camera.cpp(true).std("c++17").include("src/platform/camera").file(source);
match os.as_str() {
"windows" => {
camera.static_crt(true).flag("/EHsc");
for library in ["mf", "mfplat", "mfreadwrite", "mfuuid", "ole32"] {
println!("cargo:rustc-link-lib={library}");
}
}
"linux" => { camera.flag("-pthread"); }
"macos" | "ios" => {
camera.flag("-fobjc-arc").flag("-fblocks").flag("-fobjc-exceptions");
for framework in ["AVFoundation", "CoreMedia", "CoreVideo", "Foundation"] {
println!("cargo:rustc-link-lib=framework={framework}");
}
if os == "ios" { println!("cargo:rustc-link-lib=framework=UIKit"); }
}
_ => unreachable!(),
}
camera.compile("teamspeach_camera");
}
fn build_mobile_capture() {
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("ios") { return; }
let sources = [
"src/platform/mobile_capture/apple.mm",
"src/platform/mobile_capture/screen_capture_kit.mm",
"../platform/ios/Broadcast/CaptureWriter.mm",
];
let mut capture = cc::Build::new();
capture.cpp(true).std("c++17").flag("-fobjc-arc").flag("-fblocks").flag("-fobjc-exceptions");
for source in sources {
println!("cargo:rerun-if-changed={source}");
capture.file(source);
}
for header in ["../platform/ios/Broadcast/CaptureRing.h", "../platform/ios/Broadcast/CaptureWriter.h", "src/platform/mobile_capture/screen_capture_kit.h"] {
println!("cargo:rerun-if-changed={header}");
}
capture.compile("teamspeach_mobile_capture");
println!("cargo:rustc-link-arg=-ObjC");
for framework in ["Foundation", "UIKit", "ReplayKit", "AVFoundation", "CoreMedia", "CoreVideo", "ImageIO"] {
println!("cargo:rustc-link-lib=framework={framework}");
}
let target = std::env::var("TARGET").expect("target triple");
let sdk = if target.ends_with("-sim") { "iphonesimulator" } else { "iphoneos" };
let output = std::process::Command::new("xcrun").args(["--sdk", sdk, "--show-sdk-path"]).output().expect("locate Apple SDK");
assert!(output.status.success(), "xcrun cannot locate target Apple SDK");
let sdk_path = String::from_utf8(output.stdout).expect("Apple SDK path is UTF-8");
if std::path::Path::new(sdk_path.trim()).join("System/Library/Frameworks/ScreenCaptureKit.framework").is_dir() {
println!("cargo:rustc-link-arg=-Wl,-weak_framework,ScreenCaptureKit");
}
}
fn build_platform() {
let os = std::env::var("CARGO_CFG_TARGET_OS").expect("target OS");
let (sources, libraries): (&[&str], &[&str]) = match os.as_str() {
"windows" => (&["src/platform/desktop/windows.cpp", "src/platform/desktop/windows_toast.cpp"],
&["user32", "gdi32", "shell32", "ole32", "advapi32", "wtsapi32", "ntdll", "runtimeobject", "windowsapp", "uuid"]),
"macos" => (&["src/platform/desktop/macos.mm"],
&["AppKit", "Foundation", "UserNotifications", "ServiceManagement", "Carbon"]),
"ios" => (&["src/platform/apple/bridge.mm", "src/platform/apple/documents.mm", "src/platform/apple/pip.mm"],
&["Foundation", "UIKit", "AVFoundation", "AVKit", "CoreMedia", "CoreVideo", "UserNotifications", "Network", "UniformTypeIdentifiers"]),
_ => return,
};
let mut bridge = cc::Build::new();
bridge.cpp(true).std("c++17");
for source in sources {
println!("cargo:rerun-if-changed={source}");
bridge.file(source);
}
if os == "windows" {
bridge.static_crt(true).flag("/EHsc").flag("/utf-8");
for library in libraries { println!("cargo:rustc-link-lib={library}"); }
} else {
bridge.flag("-fobjc-arc").flag("-fblocks").flag("-fobjc-exceptions");
println!("cargo:rustc-link-arg=-ObjC");
for library in libraries { println!("cargo:rustc-link-lib=framework={library}"); }
if os == "ios" { println!("cargo:rerun-if-changed=src/platform/apple/bridge.h"); }
}
bridge.compile("teamspeach_platform");
}