Skip to content

Commit 100ab36

Browse files
committed
fix libva build
1 parent a68417f commit 100ab36

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

media/libva/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ workspace = true
1313
thiserror = "2"
1414
log = "0.4"
1515

16-
env_logger = "0.11"
17-
1816
[build-dependencies]
1917
bindgen = "0.72"
18+
pkg-config = "0.3"

media/libva/build.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
use std::env;
22

33
fn main() {
4-
println!("cargo:rustc-link-lib=va");
5-
println!("cargo:rustc-link-lib=va-drm");
4+
let libva = pkg_config::probe_library("libva").unwrap();
5+
let libva_drm = pkg_config::probe_library("libva-drm").unwrap();
66

7-
bindgen::Builder::default()
8-
.header("/usr/include/va/va.h")
9-
.header("/usr/include/va/va_drm.h")
7+
for lib in libva.libs.into_iter().chain(libva_drm.libs) {
8+
println!("cargo:rustc-link-lib={lib}");
9+
}
10+
11+
let mut bindgen = bindgen::Builder::default();
12+
13+
for include_path in libva
14+
.include_paths
15+
.into_iter()
16+
.chain(libva_drm.include_paths)
17+
{
18+
bindgen = bindgen.clang_arg(format!("-I{}", include_path.to_string_lossy()));
19+
}
20+
21+
bindgen
22+
.header("wrapper.h")
1023
.allowlist_function("(va|VA).*")
1124
.allowlist_type("(va|VA).*")
1225
.allowlist_var("(va|VA).*")

media/libva/wrapper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
#include <va/va.h>
3+
#include <va/va_drm.h>

0 commit comments

Comments
 (0)