build.rs 695 B

1234567891011121314151617181920212223
  1. // Copyright 2024, Linaro Limited
  2. // Author(s): Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
  3. // SPDX-License-Identifier: GPL-2.0-or-later
  4. use std::path::Path;
  5. use version_check as rustc;
  6. fn main() {
  7. if !Path::new("src/bindings.rs").exists() {
  8. panic!(
  9. "No generated C bindings found! Either build them manually with bindgen or with meson \
  10. (`ninja bindings.rs`) and copy them to src/bindings.rs, or build through meson."
  11. );
  12. }
  13. // Check for available rustc features
  14. if rustc::is_min_version("1.77.0").unwrap_or(false) {
  15. println!("cargo:rustc-cfg=has_offset_of");
  16. }
  17. println!("cargo:rerun-if-changed=build.rs");
  18. }