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