From deb85a2245b9997a57113e6fcd1306e170b7e1b2 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Mon, 29 Aug 2022 01:11:46 +0900 Subject: [PATCH 1/2] cargo new lax-bindgen --- Cargo.toml | 1 + lax-bindgen/Cargo.toml | 8 ++++++++ lax-bindgen/src/main.rs | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 lax-bindgen/Cargo.toml create mode 100644 lax-bindgen/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index ba1ae403..4a9ad966 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,4 +2,5 @@ members = [ "ndarray-linalg", "lax", + "lax-bindgen", ] diff --git a/lax-bindgen/Cargo.toml b/lax-bindgen/Cargo.toml new file mode 100644 index 00000000..9348cab4 --- /dev/null +++ b/lax-bindgen/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "lax-bindgen" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/lax-bindgen/src/main.rs b/lax-bindgen/src/main.rs new file mode 100644 index 00000000..e7a11a96 --- /dev/null +++ b/lax-bindgen/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} From f0c88d93707cb3dcb8f72b5a4e71d8cc67d88121 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Mon, 29 Aug 2022 14:48:33 +0900 Subject: [PATCH 2/2] Re-parse lapack-sys crate --- .gitmodules | 3 +++ lax-bindgen/Cargo.toml | 4 ++++ lax-bindgen/lapack-sys | 1 + lax-bindgen/src/main.rs | 13 +++++++++++-- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 160000 lax-bindgen/lapack-sys diff --git a/.gitmodules b/.gitmodules index e69de29b..14773f6a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lax-bindgen/lapack-sys"] + path = lax-bindgen/lapack-sys + url = git@github.com:blas-lapack-rs/lapack-sys.git diff --git a/lax-bindgen/Cargo.toml b/lax-bindgen/Cargo.toml index 9348cab4..89b2b4c6 100644 --- a/lax-bindgen/Cargo.toml +++ b/lax-bindgen/Cargo.toml @@ -6,3 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +anyhow = "1.0.62" +proc-macro2 = "1.0.43" +quote = "1.0.21" +syn = { version = "1.0.99", features = ["full", "extra-traits"] } diff --git a/lax-bindgen/lapack-sys b/lax-bindgen/lapack-sys new file mode 160000 index 00000000..6f42e18f --- /dev/null +++ b/lax-bindgen/lapack-sys @@ -0,0 +1 @@ +Subproject commit 6f42e18ff245e0b53527a24211af1f640b4b637d diff --git a/lax-bindgen/src/main.rs b/lax-bindgen/src/main.rs index e7a11a96..af3dc9db 100644 --- a/lax-bindgen/src/main.rs +++ b/lax-bindgen/src/main.rs @@ -1,3 +1,12 @@ -fn main() { - println!("Hello, world!"); +use anyhow::Result; +use std::{fs, path::PathBuf}; + +fn main() -> Result<()> { + let crate_root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let lapack_sys = fs::read_to_string(crate_root.join("lapack-sys/src/lapack.rs"))?; + + let file: syn::File = syn::parse_str(&lapack_sys)?; + dbg!(file); + + Ok(()) }