Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3382072
D5434.id17809.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5434.id17809.diff
View Options
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,51 @@
+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<String> = Vec::<String>::new();
+ for entry in
+ glob(String::from(path.to_owned() + "/**/*.cpp").as_str()).unwrap()
+ {
+ sources.push(String::from(entry.unwrap().display().to_string()));
+ }
+ sources
+}
+
+fn add_import_path(import_path: &str) {
+ let shared_headers_import_path = fs::canonicalize(import_path).unwrap();
+ CFG.exported_header_dirs.push(&shared_headers_import_path);
+}
+
+fn main() {
+ add_import_path("../../services/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("../../services/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=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
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 8:18 AM (20 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596406
Default Alt Text
D5434.id17809.diff (1 KB)
Attached To
Mode
D5434: [services] Tunnelbroker - Creating `build.rs` file for building and linking C++ dependencies
Attached
Detach File
Event Timeline
Log In to Comment