1 //! Builds the placeholder C engine next to the bundle. Replace `engine.c`2 //! with a small adapter over the real library; keep the output name, because3 //! `entry` in `bundle.toml` names `engine/libengine.so`.4 5 use std::path::PathBuf;6 use std::process::Command;7 8 fn main() {9 println!("cargo:rerun-if-changed=engine/engine.c");10 let root = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").expect("a manifest dir"));11 let source = root.join("engine").join("engine.c");12 let library = root.join("engine").join("libengine.so");13 let status = Command::new("cc")14 .args(["-shared", "-fPIC", "-O2", "-std=c11", "-o"])15 .arg(&library)16 .arg(&source)17 .status()18 .expect("a C compiler");19 assert!(status.success(), "cc failed for {}", source.display());20 println!("cargo:rustc-env=INF3R_ENGINE_LIB={}", library.display());21 }