• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use pkg_config::Config;
2 
main()3 fn main() {
4     let target_dir = std::env::var_os("CARGO_TARGET_DIR").unwrap();
5 
6     // The main linking point with c++ code is the libbluetooth-static.a
7     // These includes all the symbols built via C++ but doesn't include other
8     // links (i.e. pkg-config)
9     println!("cargo:rustc-link-lib=static=bluetooth-static");
10     println!("cargo:rustc-link-search=native={}", target_dir.into_string().unwrap());
11 
12     // A few dynamic links
13     println!("cargo:rustc-link-lib=dylib=flatbuffers");
14     println!("cargo:rustc-link-lib=dylib=protobuf");
15     println!("cargo:rustc-link-lib=dylib=resolv");
16 
17     // Clang requires -lc++ instead of -lstdc++
18     println!("cargo:rustc-link-lib=c++");
19 
20     // A few more dependencies from pkg-config. These aren't included as part of
21     // the libbluetooth-static.a
22     Config::new().probe("libchrome").unwrap();
23     Config::new().probe("libmodp_b64").unwrap();
24     Config::new().probe("tinyxml2").unwrap();
25 
26     println!("cargo:rerun-if-changed=build.rs");
27 }
28