• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 //! Build script for linking `hostapd-rs` with dependencies.
16 
17 /// Build script for linking `hostapd-rs` with the `hostapd` C library and OS specific dependencies.
main()18 pub fn main() {
19     let objs_path = std::env::var("OBJS_PATH").unwrap_or("../objs".to_string());
20 
21     // Shared dependencies
22     println!("cargo:rustc-link-search={objs_path}/archives");
23     println!("cargo:rustc-link-lib=hostapd");
24     println!("cargo:rustc-link-lib=crypto");
25     println!("cargo:rustc-link-lib=android-emu-base");
26     println!("cargo:rustc-link-lib=android-emu-utils");
27     println!("cargo:rustc-link-lib=logging-base");
28     println!("cargo:rustc-link-lib=android-emu-base-logging");
29     // Linux and Mac dependencies
30     #[cfg(unix)]
31     {
32         println!("cargo:rustc-link-search={objs_path}/lib64");
33         println!("cargo:rustc-link-lib=c++");
34     }
35     // Windows dependencies
36     #[cfg(windows)]
37     {
38         println!("cargo:rustc-link-lib=crypto_asm_lib");
39         println!("cargo:rustc-link-search={objs_path}/msvc-posix-compat/msvc-compat-layer");
40         println!("cargo:rustc-link-lib=msvc-posix-compat");
41         println!("cargo:rustc-link-search=C:/Windows/System32");
42         println!("cargo:rustc-link-lib=vcruntime140");
43     }
44 }
45