changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > demo / build.rs

changeset 0: eb8ed24e8a76
child: e4f8df713d55
author: ellis <ellis@rwest.io>
date: Sun, 30 Apr 2023 22:01:32 -0400
permissions: -rw-r--r--
description: init
1 use std::env;
2 use std::fs::create_dir;
3 use std::path::PathBuf;
4 fn main() {
5  let crate_dir: PathBuf = env::var("CARGO_MANIFEST_DIR")
6  .expect("CARGO_MANIFEST_DIR env var is not defined")
7  .into();
8  let mpk_py = "build.py";
9  let config = cbindgen::Config::from_file("cbindgen.toml")
10  .expect("Unable to find cbindgen.toml configuration file");
11  let build_dir = crate_dir.join("build/");
12  if !build_dir.exists() {
13  create_dir(&build_dir).unwrap();
14  }
15  cbindgen::generate_with_config(&crate_dir, config)
16  .unwrap()
17  .write_to_file(build_dir.join("mpk_ffi.h"));
18 }