/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Build script for the Gecko Profiler bindings. //! //! This file is executed by cargo when this crate is built. It generates the //! `$OUT_DIR/bindings.rs` file which is then included by `src/gecko_bindings/mod.rs`.
#[macro_use] externcrate lazy_static;
use bindgen::{Builder, CodegenConfig}; use std::env; use std::fs; use std::path::PathBuf;
for item in &*BINDGEN_FLAGS {
builder = builder.clang_arg(item);
}
let bindings = builder
.header(add_include("GeckoProfiler.h"))
.header(add_include("ProfilerBindings.h"))
.allowlist_function("gecko_profiler_.*")
.allowlist_var("mozilla::profiler::detail::RacyFeatures::sActiveAndFeatures")
.allowlist_type("mozilla::profiler::detail::RacyFeatures")
.rustified_enum("mozilla::StackCaptureOptions")
.rustified_enum("mozilla::MarkerSchema_Location")
.rustified_enum("mozilla::MarkerSchema_Format")
.rustified_enum("mozilla::MarkerSchema_Searchable") // Converting std::string to an opaque type makes some platforms build // successfully. Otherwise, it fails to build because MarkerSchema has // some std::strings as its fields.
.opaque_type("std::string") // std::vector needs to be converted to an opaque type because, if it's // not an opaque type, bindgen can't find its size properly and // MarkerSchema's total size reduces. That causes a heap buffer overflow.
.opaque_type("std::vector")
.raw_line("pub use self::root::*;") // Tell cargo to invalidate the built crate whenever any of the // included header files changed.
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) // Finish the builder and generate the bindings.
.generate() // Unwrap the Result and panic on failure.
.expect("Unable to generate bindings");
let out_file = OUTDIR_PATH.join(BINDINGS_FILE);
bindings
.write_to_file(out_file)
.expect("Couldn't write bindings!");
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.11Bemerkung:
(vorverarbeitet am 2026-06-19)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.