Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33308121
D5434.1768800619.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5434.1768800619.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,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
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 5:30 AM (7 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5953199
Default Alt Text
D5434.1768800619.diff (2 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