1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2025-01-03 10:06:01 +01:00

Fixing publish

This commit is contained in:
Anthony Scemama 2023-10-23 18:18:34 +02:00
parent 9919d4da8d
commit 297a71ffb0
3 changed files with 13 additions and 8 deletions

View File

@ -6,7 +6,7 @@ license = "BSD-3-Clause"
authors = ["Anthony Scemama <scemama@irsamc.ups-tlse.fr>", "Evgeny Posenitskiy"]
description = "TREXIO is an open-source file format and library developed for the storage and manipulation of data produced by quantum chemistry calculations. It is designed with the goal of providing a reliable and efficient method of storing and exchanging wave function parameters and matrix elements."
repository = "https://github.com/trex-coe/trexio"
keywords = ["quantum chemistry"]
keywords = ["quantum", "chemistry"]
readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,5 +1,5 @@
const WRAPPER_H: &str = "wrapper.h";
const GENERATED_RS: &str = "src/generated.rs";
const GENERATED_RS: &str = "generated.rs";
use std::env;
use std::path::PathBuf;
@ -7,7 +7,6 @@ use std::collections::HashMap;
use std::fs::File;
use std::io::{self, BufRead, BufReader, Write};
use serde_json::Value;
use std::path::Path;
@ -91,7 +90,9 @@ fn make_interface() -> io::Result<()> {
}
}
let mut wrapper_file = File::create(WRAPPER_H)?;
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let wrapper_h = out_path.join(WRAPPER_H);
let mut wrapper_file = File::create(wrapper_h)?;
write!(&mut wrapper_file, "#include <trexio.h>\n")?;
for (k, v) in &err {
@ -677,7 +678,8 @@ impl File {
r.push(String::from("}"));
let generated_rs = Path::new(GENERATED_RS);
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let generated_rs = out_path.join(GENERATED_RS);
let mut f = File::create(&generated_rs)?;
f.write_all(r.join("\n").as_bytes())?;
Ok(())
@ -697,14 +699,17 @@ fn main() {
// Tell cargo to invalidate the built crate whenever the wrapper changes
println!("cargo:rerun-if-changed=wrapper.h");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
make_interface().unwrap();
// The bindgen::Builder is the main entry point
// to bindgen, and lets you build up options for
// the resulting bindings.
let wrapper_h = out_path.join("wrapper.h");
let bindings = bindgen::Builder::default()
// The input header we would like to generate
// bindings for.
.header("wrapper.h")
.header(wrapper_h.to_str().unwrap())
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
@ -714,7 +719,6 @@ fn main() {
.expect("Unable to generate bindings");
// Write the bindings to the $OUT_DIR/bindings.rs file.
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let bindings_path = out_path.join("bindings.rs");
bindings
.write_to_file(&bindings_path)

View File

@ -257,4 +257,5 @@ impl File {
}
}
include!("generated.rs");
include!(concat!(env!("OUT_DIR"), "/generated.rs"));