build.rs 895 B

12345678910111213141516171819202122232425
  1. fn main() {
  2. println!("cargo:rustc-link-search=native=./build/gblibstdc++");
  3. println!("cargo:rustc-link-lib=static=gblibstdc++");
  4. let headers = ["include/kernel/process.hpp", "include/kernel/hw/pci.hpp"];
  5. let bindings = bindgen::Builder::default()
  6. .use_core()
  7. .ctypes_prefix("core::ffi")
  8. .headers(headers)
  9. .clang_arg("-I./gblibstdc++/include")
  10. .clang_arg("-I./gblibc/include")
  11. .clang_arg("-I./include")
  12. .clang_arg("-std=c++20")
  13. .opaque_type("std::.*")
  14. .enable_cxx_namespaces()
  15. .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
  16. .generate()
  17. .expect("Unable to generate bindings");
  18. let out_path = std::path::PathBuf::from(std::env::var("PWD").unwrap());
  19. bindings
  20. .write_to_file(out_path.join("src/bindings.rs"))
  21. .expect("Couldn't write bindings!");
  22. }