Adding library for high-level code generators.
The intention here is to provide a way for high level code generators
to convert a Rust TokenStream into C++ bindings code without the need
to write files to disk or invoke an external command.
diff --git a/gen/lib/Cargo.toml b/gen/lib/Cargo.toml
new file mode 100644
index 0000000..3a5d938
--- /dev/null
+++ b/gen/lib/Cargo.toml
@@ -0,0 +1,21 @@
+[package]
+name = "cxx-gen"
+version = "0.3.4"
+authors = ["David Tolnay <dtolnay@gmail.com>"]
+edition = "2018"
+license = "MIT OR Apache-2.0"
+description = "C++ code generator for integrating `cxx` crate into higher level tools."
+repository = "https://github.com/dtolnay/cxx"
+keywords = ["ffi"]
+categories = ["development-tools::ffi"]
+
+[dependencies]
+anyhow = "1.0"
+cc = "1.0.49"
+codespan-reporting = "0.9"
+proc-macro2 = { version = "1.0.17", default-features = false, features = ["span-locations"] }
+quote = { version = "1.0", default-features = false }
+syn = { version = "1.0.20", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] }
+
+[package.metadata.docs.rs]
+targets = ["x86_64-unknown-linux-gnu"]
diff --git a/gen/lib/LICENSE-APACHE b/gen/lib/LICENSE-APACHE
new file mode 120000
index 0000000..1cd601d
--- /dev/null
+++ b/gen/lib/LICENSE-APACHE
@@ -0,0 +1 @@
+../../LICENSE-APACHE
\ No newline at end of file
diff --git a/gen/lib/LICENSE-MIT b/gen/lib/LICENSE-MIT
new file mode 120000
index 0000000..b2cfbdc
--- /dev/null
+++ b/gen/lib/LICENSE-MIT
@@ -0,0 +1 @@
+../../LICENSE-MIT
\ No newline at end of file
diff --git a/gen/lib/src/gen b/gen/lib/src/gen
new file mode 120000
index 0000000..929cb3d
--- /dev/null
+++ b/gen/lib/src/gen
@@ -0,0 +1 @@
+../../src
\ No newline at end of file
diff --git a/gen/lib/src/lib.rs b/gen/lib/src/lib.rs
new file mode 100644
index 0000000..ba125d9
--- /dev/null
+++ b/gen/lib/src/lib.rs
@@ -0,0 +1,17 @@
+//! The CXX code generator for constructing and compiling C++ code.
+//!
+//! This is intended to be embedded into higher-level code generators.
+
+mod gen;
+mod syntax;
+
+use crate::gen::Opt;
+use proc_macro2::TokenStream;
+
+pub use crate::gen::{Error, Result, GeneratedCode};
+
+/// Generate C++ bindings code from a Rust token stream. This should be a Rust
+/// token stream which somewhere contains a `#[cxx::bridge] mod {}`.
+pub fn generate_header_and_cc(rust_source: TokenStream) -> Result<GeneratedCode> {
+ gen::do_generate_from_tokens(rust_source, Opt::default())
+}
diff --git a/gen/lib/src/syntax b/gen/lib/src/syntax
new file mode 120000
index 0000000..a6fe06c
--- /dev/null
+++ b/gen/lib/src/syntax
@@ -0,0 +1 @@
+../../../syntax
\ No newline at end of file