xref: /aosp_15_r20/tools/netsim/rust/hostapd-rs/build.rs (revision cf78ab8cffb8fc9207af348f23af247fb04370a6)
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 the `hostapd` C library and its dependencies.
16 
main()17 pub fn main() {
18     let objs_path = std::env::var("OBJS_PATH").unwrap_or("../objs".to_string());
19 
20     // Shared dependencies
21     println!("cargo:rustc-link-search={objs_path}/archives");
22     println!("cargo:rustc-link-lib=hostapd");
23     println!("cargo:rustc-link-lib=crypto");
24     println!("cargo:rustc-link-lib=android-emu-base");
25     println!("cargo:rustc-link-lib=android-emu-utils");
26     println!("cargo:rustc-link-lib=logging-base");
27     println!("cargo:rustc-link-lib=android-emu-base-logging");
28     // Linux and Mac dependencies
29     #[cfg(unix)]
30     {
31         println!("cargo:rustc-link-search={objs_path}/lib64");
32         println!("cargo:rustc-link-lib=c++");
33     }
34     // Windows dependencies
35     #[cfg(windows)]
36     {
37         println!("cargo:rustc-link-lib=crypto_asm_lib");
38         println!("cargo:rustc-link-search={objs_path}/msvc-posix-compat/msvc-compat-layer");
39         println!("cargo:rustc-link-lib=msvc-posix-compat");
40         println!("cargo:rustc-link-search=C:/Windows/System32");
41         println!("cargo:rustc-link-lib=vcruntime140");
42     }
43 }
44