Skip to content

Commit

Permalink
refactor: do not write to source directory
Browse files Browse the repository at this point in the history
  • Loading branch information
zitsen committed May 21, 2019
1 parent 8520fb2 commit 3cd20d4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
target
Cargo.lock
*.bk
src/ffi.rs
rls
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
extern crate bindgen;
extern crate cc;

use std::env::var;
use std::path::Path;
fn main() {
use bindgen::builder;
// Configure and generate bindings.
Expand All @@ -10,7 +12,7 @@ fn main() {
.expect("generate unqlite bindings");
// Write the generated bindings to an output file.
bindings
.write_to_file("src/ffi.rs")
.write_to_file(Path::new(&var("OUT_DIR").expect("OUT_DIR should be exist")).join("ffi.rs"))
.expect("write to source file");

cc::Build::new()
Expand Down
1 change: 1 addition & 0 deletions src/ffi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/ffi.rs"));

0 comments on commit 3cd20d4

Please sign in to comment.