Skip to content

Commit 3f67742

Browse files
committed
fix compile for arm64.
1 parent 2dad966 commit 3f67742

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

webrtc-sys/build.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ fn main() {
110110
println!("cargo:rustc-link-lib=static=webrtc");
111111

112112
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
113+
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
113114
match target_os.as_str() {
114115
"windows" => {
115116
println!("cargo:rustc-link-lib=dylib=msdmo");
@@ -152,16 +153,23 @@ fn main() {
152153
println!("cargo:rustc-link-lib=dylib=pthread");
153154
println!("cargo:rustc-link-lib=dylib=m");
154155

155-
builder
156-
.file("src/vaapi/vaapi_display_drm.cpp")
157-
.file("src/vaapi/vaapi_h264_encoder_wrapper.cpp")
158-
.file("src/vaapi/vaapi_encoder_factory.cpp")
159-
.file("src/vaapi/h264_encoder_impl.cpp")
160-
.file("src/vaapi/implib/libva-drm.so.init.c")
161-
.file("src/vaapi/implib/libva-drm.so.tramp.S")
162-
.file("src/vaapi/implib/libva.so.init.c")
163-
.file("src/vaapi/implib/libva.so.tramp.S")
164-
.flag("-std=c++2a");
156+
match target_arch.as_str() {
157+
"x86_64" => {
158+
builder
159+
.file("src/vaapi/vaapi_display_drm.cpp")
160+
.file("src/vaapi/vaapi_h264_encoder_wrapper.cpp")
161+
.file("src/vaapi/vaapi_encoder_factory.cpp")
162+
.file("src/vaapi/h264_encoder_impl.cpp")
163+
.file("src/vaapi/implib/libva-drm.so.init.c")
164+
.file("src/vaapi/implib/libva-drm.so.tramp.S")
165+
.file("src/vaapi/implib/libva.so.init.c")
166+
.file("src/vaapi/implib/libva.so.tramp.S");
167+
}
168+
_ => {},
169+
170+
}
171+
172+
builder.flag("-std=c++2a");
165173
}
166174
"macos" => {
167175
println!("cargo:rustc-link-lib=framework=Foundation");

webrtc-sys/src/video_encoder_factory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "livekit/android.h"
3838
#endif
3939

40-
#if defined(__linux__)
40+
#if defined(__linux__) && defined(__x86_64__)
4141
#include "vaapi/vaapi_encoder_factory.h"
4242
#endif
4343

@@ -62,7 +62,7 @@ VideoEncoderFactory::InternalFactory::InternalFactory() {
6262
factories_.push_back(CreateAndroidVideoEncoderFactory());
6363
#endif
6464

65-
#if defined(__linux__)
65+
#if defined(__linux__) && defined(__x86_64__)
6666
if (webrtc::VAAPIVideoEncoderFactory::IsSupported()) {
6767
factories_.push_back(std::make_unique<webrtc::VAAPIVideoEncoderFactory>());
6868
}

0 commit comments

Comments
 (0)