Skip to content

Commit 5bddc1f

Browse files
committed
Comment out bindgen steps in build.rs files to speed up build
1 parent 1ef2958 commit 5bddc1f

File tree

3 files changed

+51
-54
lines changed

3 files changed

+51
-54
lines changed

src/rust/blosc-sys/build.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,8 @@ extern crate cmake;
22
extern crate bindgen;
33

44
use std::env;
5-
use std::path::PathBuf;
65

76
fn main() {
8-
let bindings = bindgen::Builder::default()
9-
.header("wrapper.h")
10-
.use_core()
11-
.ctypes_prefix("libc")
12-
.whitelist_function(".*compress.*")
13-
.whitelist_function(".*shuffle.*")
14-
.whitelist_function(".*threads.*")
15-
.whitelist_function(".*version.*")
16-
.generate()
17-
.expect("Unable to generate bindings");
18-
19-
// Write the bindings to the $OUT_DIR/bindings.rs file.
20-
let out_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
21-
bindings
22-
.write_to_file(out_path.join("src/bindings.rs"))
23-
.expect("Couldn't write bindings!");
24-
257
// TODO deduplicate code, only MinGW line for Windows, check if on MSVC
268
if cfg!(windows) {
279
if cfg!(target_env = "gnu") {
@@ -58,7 +40,7 @@ fn main() {
5840
.define("PREFER_EXTERNAL_SNAPPY", "OFF")
5941
.define("PREFER_EXTERNAL_ZLIB", "OFF")
6042
.define("PREFER_EXTERNAL_ZSTD", "OFF")
61-
// .define("CMAKE_BUILD_TYPE", "Release") - cmake-rs does the right this depending on opt-level and debug/release
43+
// .define("CMAKE_BUILD_TYPE", "Release") - cmake-rs does this right depending on opt-level and debug/release
6244
.static_crt(true)
6345
.build();
6446
println!("cargo:rustc-link-search=native={}/lib", dst.display());
@@ -83,4 +65,21 @@ fn main() {
8365
println!("cargo:rustc-link-search=native={}/lib", dst.display());
8466
println!("cargo:rustc-link-lib=static=blosc");
8567
}
68+
69+
// let bindings = bindgen::Builder::default()
70+
// .header("wrapper.h")
71+
// .use_core()
72+
// .ctypes_prefix("libc")
73+
// .whitelist_function(".*compress.*")
74+
// .whitelist_function(".*shuffle.*")
75+
// .whitelist_function(".*threads.*")
76+
// .whitelist_function(".*version.*")
77+
// .generate()
78+
// .expect("Unable to generate bindings");
79+
80+
// // Write the bindings to the $OUT_DIR/bindings.rs file.
81+
// let out_path = std::path::PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
82+
// bindings
83+
// .write_to_file(out_path.join("src/bindings.rs"))
84+
// .expect("Couldn't write bindings!");
8685
}

src/rust/lmdb-sys/build.rs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
extern crate cc;
22

33
use std::env;
4-
use std::path::PathBuf;
54

65
fn main() {
7-
let mut lmdb: PathBuf = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
6+
let mut lmdb = std::path::PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
87
lmdb.push("lmdb");
98
lmdb.push("libraries");
109
lmdb.push("liblmdb");
@@ -17,23 +16,23 @@ fn main() {
1716
.static_crt(true)
1817
.compile("liblmdb.a");
1918

20-
let bindings = bindgen::Builder::default()
21-
.header("wrapper.h")
22-
.generate_comments(true)
23-
.use_core()
24-
.ctypes_prefix("libc")
25-
.whitelist_function("mdb_.*") // it adds recursively all used types so the next line in this case changes nothing for this particular case
26-
.whitelist_type("mdb_.*")
27-
.prepend_enum_name(false)
28-
.constified_enum_module("MDB_cursor_op") // allows access to enum values as MDB_cursor_op.MDB_NEXT
29-
.generate()
30-
.expect("Unable to generate bindings");
19+
// let bindings = bindgen::Builder::default()
20+
// .header("wrapper.h")
21+
// .generate_comments(true)
22+
// .use_core()
23+
// .ctypes_prefix("libc")
24+
// .whitelist_function("mdb_.*") // it adds recursively all used types so the next line in this case changes nothing for this particular case
25+
// .whitelist_type("mdb_.*")
26+
// .prepend_enum_name(false)
27+
// .constified_enum_module("MDB_cursor_op") // allows access to enum values as MDB_cursor_op.MDB_NEXT
28+
// .generate()
29+
// .expect("Unable to generate bindings");
3130

32-
// Write the bindings to src folder to make rls autocomplete work.
33-
let out_path = PathBuf::from("src");
34-
bindings
35-
.write_to_file(out_path.join("bindings.rs"))
36-
.expect("Couldn't write bindings!");
31+
// // Write the bindings to src folder to make rls autocomplete work.
32+
// let out_path = std::path::PathBuf::from("src");
33+
// bindings
34+
// .write_to_file(out_path.join("bindings.rs"))
35+
// .expect("Couldn't write bindings!");
3736

3837
// Tell cargo to tell rustc to link the lmdb library.
3938
println!("cargo:rustc-link-lib=static=lmdb");

src/rust/sqlite-sys/build.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
extern crate cc;
22

33
use std::env;
4-
use std::path::PathBuf;
54

65
fn main() {
7-
let mut sqlite: PathBuf = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
6+
let mut sqlite = std::path::PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
87
sqlite.push("sqlite");
98

109
cc::Build::new()
@@ -27,22 +26,22 @@ fn main() {
2726
.static_crt(true)
2827
.compile("libsqlite3.a");
2928

30-
let bindings = bindgen::Builder::default()
31-
.header("wrapper.h")
32-
.generate_comments(true)
33-
.use_core()
34-
.ctypes_prefix("libc")
35-
.whitelist_function("sqlite3_.*")
36-
.whitelist_type("sqlite3_.*")
37-
.prepend_enum_name(false)
38-
.generate()
39-
.expect("Unable to generate bindings");
29+
// let bindings = bindgen::Builder::default()
30+
// .header("wrapper.h")
31+
// .generate_comments(true)
32+
// .use_core()
33+
// .ctypes_prefix("libc")
34+
// .whitelist_function("sqlite3_.*")
35+
// .whitelist_type("sqlite3_.*")
36+
// .prepend_enum_name(false)
37+
// .generate()
38+
// .expect("Unable to generate bindings");
4039

41-
// Write the bindings to src folder to make rls autocomplete work.
42-
let out_path = PathBuf::from("src");
43-
bindings
44-
.write_to_file(out_path.join("bindings.rs"))
45-
.expect("Couldn't write bindings!");
40+
// // Write the bindings to src folder to make rls autocomplete work.
41+
// let out_path = std::path::PathBuf::from("src");
42+
// bindings
43+
// .write_to_file(out_path.join("bindings.rs"))
44+
// .expect("Couldn't write bindings!");
4645

4746
// Tell cargo to tell rustc to link the lmdb library.
4847
println!("cargo:rustc-link-lib=static=sqlite3");

0 commit comments

Comments
 (0)