use lvgl_codegen::{CodeGen, Rusty}; use proc_macro2::TokenStream; use quote::quote; use std::env; use std::fs::File; use std::io::prelude::*; use std::path::PathBuf; fn main() { let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let rs = out_path.join("generated.rs"); let widgets_impl = lvgl_sys::_bindgen_raw_src(); let codegen = CodeGen::from(widgets_impl).unwrap(); let widgets_impl: Vec = codegen .get_widgets() .iter() .flat_map(|w| w.code(&())) .collect(); let code = quote! { #(#widgets_impl)* }; let mut file = File::create(rs).unwrap(); writeln!( file, "/* automatically generated by lvgl-codegen */\n{}", code ) .unwrap(); }