Page MenuHomePhabricator

D5434.id18118.diff
No OneTemporary

D5434.id18118.diff

diff --git a/services/tunnelbroker/build.rs b/services/tunnelbroker/build.rs
new file mode 100644
--- /dev/null
+++ b/services/tunnelbroker/build.rs
@@ -0,0 +1,54 @@
+use cxx_build::CFG;
+use glob::glob;
+use std::fs;
+use std::path::Path;
+
+fn get_cpp_sources(path: &str) -> Vec<String> {
+ let mut sources = vec![];
+ let files = glob(String::from(path.to_owned() + "/**/*.cpp").as_str())
+ .expect("Error gathering .cpp file paths");
+ for entry in files {
+ sources.push(entry.unwrap().display().to_string());
+ }
+ sources
+}
+
+fn add_import_path(import_path: &str) {
+ let shared_headers_import_path =
+ fs::canonicalize(import_path).expect("Error getting full import path");
+ CFG.exported_header_dirs.push(&shared_headers_import_path);
+}
+
+fn main() {
+ add_import_path("../lib/src");
+ add_import_path("src/libcpp/src");
+ add_import_path("src/libcpp/src/Amqp");
+ add_import_path("src/libcpp/src/Database");
+ add_import_path("src/libcpp/src/DeliveryBroker");
+ add_import_path("src/libcpp/src/Tools");
+
+ cxx_build::bridge("src/main.rs")
+ .files(get_cpp_sources("../lib/src"))
+ .files(get_cpp_sources("src/libcpp/src"))
+ .file(Path::new("src/libcpp/Tunnelbroker.cpp"))
+ .flag_if_supported("-std=c++17")
+ .flag_if_supported("-w")
+ .compile("tunnelbroker");
+
+ println!("cargo:rustc-link-lib=boost_program_options");
+ println!("cargo:rustc-link-lib=boost_system");
+ println!("cargo:rustc-link-lib=folly");
+ println!("cargo:rustc-link-lib=double-conversion");
+ println!("cargo:rustc-link-lib=gflags");
+ println!("cargo:rustc-link-lib=amqpcpp");
+ println!("cargo:rustc-link-lib=glog");
+ println!("cargo:rustc-link-lib=cryptopp");
+ println!("cargo:rustc-link-lib=ssl");
+ println!("cargo:rustc-link-lib=uv");
+ println!("cargo:rustc-link-lib=aws-cpp-sdk-core");
+ println!("cargo:rustc-link-lib=aws-cpp-sdk-dynamodb");
+
+ println!("cargo:rerun-if-changed=src/main.rs");
+ println!("cargo:rerun-if-changed=src/libcpp/Tunnelbroker.h");
+ println!("cargo:rerun-if-changed=src/libcpp/Tunnelbroker.cpp");
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 8:27 AM (20 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596420
Default Alt Text
D5434.id18118.diff (2 KB)

Event Timeline