Skip to content

Commit

Permalink
Don't use include!()
Browse files Browse the repository at this point in the history
  • Loading branch information
rosetta-jpn committed Oct 30, 2024
1 parent 2be2ee2 commit 5c58760
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions android/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

//! cros-libva bindings generator in Android.
include!("../lib/bindgen.rs");
#[path = "../lib/bindgen_gen.rs"]
mod bindgen_gen;

fn main() {
bindgen_cmd::build(vaapi_gen_builder);
bindgen_cmd::build(bindgen_gen::vaapi_gen_builder);
}
1 change: 1 addition & 0 deletions lib/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ rust_library {
enabled: true,
// Bindgen-generated bindings of our local libva headers.
srcs: [":libcros_libva_bindgen"],
shared_libs: [ "libva" ],
},
},
}
2 changes: 1 addition & 1 deletion lib/bindgen.rs → lib/bindgen_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const ALLOW_LIST_TYPE : &str = ".*ExternalBuffers.*|.*PRIME.*|.*MPEG2.*|.*VP8.*|.*VP9.*|.*H264.*|.*HEVC.*|VACodedBufferSegment|.*AV1.*|VAEncMisc.*|VASurfaceDecodeMBErrors|VADecodeErrorType";

// The common bindgen builder for VA-API.
fn vaapi_gen_builder(builder: bindgen::Builder) -> bindgen::Builder {
pub fn vaapi_gen_builder(builder: bindgen::Builder) -> bindgen::Builder {
builder
.derive_default(true)
.derive_eq(true)
Expand Down
3 changes: 2 additions & 1 deletion lib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
use std::env::{self};
use std::path::{Path, PathBuf};

include!("bindgen.rs");
mod bindgen_gen;
use bindgen_gen::vaapi_gen_builder;

/// Environment variable that can be set to point to the directory containing the `va.h`, `va_drm.h` and `va_drmcommon.h`
/// files to use to generate the bindings.
Expand Down

0 comments on commit 5c58760

Please sign in to comment.