Skip to content

Commit 0bd5e0d

Browse files
committed
build: use cassandra.h from top-level include directory
Currently, we use two cassandra.h files during build. - include/cassandra.h -> an original file, copied from cpp-driver - scylla-rust-wrapper/extern/cassandra.h -> a copy of the above file, used to generate bindings in build.rs. Having both of the files is error-prone, since we need to remember to update both of the files in case of some changes. We also need to make sure that their contents are the same. In this commit, I update `build.rs` to point to original cassandra.h file (which is out of the scope of Cargo project, but it does not seem to be a problem).
1 parent 3bb9a49 commit 0bd5e0d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scylla-rust-wrapper/build.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ extern crate bindgen;
33
use std::env;
44
use std::path::{Path, PathBuf};
55

6+
const RELATIVE_PATH_TO_CASSANDRA_H: &str = "../include/cassandra.h";
7+
68
fn prepare_full_bindings(out_path: &Path) {
79
let bindings = bindgen::Builder::default()
8-
.header("extern/cassandra.h")
10+
.header(RELATIVE_PATH_TO_CASSANDRA_H)
911
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
1012
.layout_tests(false)
1113
.generate_comments(false)
@@ -23,7 +25,7 @@ fn prepare_full_bindings(out_path: &Path) {
2325

2426
fn prepare_basic_types(out_path: &Path) {
2527
let basic_bindings = bindgen::Builder::default()
26-
.header("extern/cassandra.h")
28+
.header(RELATIVE_PATH_TO_CASSANDRA_H)
2729
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
2830
.layout_tests(true)
2931
.generate_comments(false)
@@ -56,7 +58,7 @@ fn prepare_basic_types(out_path: &Path) {
5658

5759
fn prepare_cppdriver_data(outfile: &str, allowed_types: &[&str], out_path: &Path) {
5860
let mut type_bindings = bindgen::Builder::default()
59-
.header("extern/cassandra.h")
61+
.header(RELATIVE_PATH_TO_CASSANDRA_H)
6062
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
6163
.layout_tests(true)
6264
.generate_comments(false)
@@ -79,7 +81,7 @@ fn prepare_cppdriver_data(outfile: &str, allowed_types: &[&str], out_path: &Path
7981
}
8082

8183
fn main() {
82-
println!("cargo:rerun-if-changed=extern/cassandra.h");
84+
println!("cargo:rerun-if-changed={}", RELATIVE_PATH_TO_CASSANDRA_H);
8385
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
8486
prepare_full_bindings(&out_path);
8587
prepare_basic_types(&out_path);

0 commit comments

Comments
 (0)