1cac7dca0Sopenharmony_ci// Copyright (c) 2023 Huawei Device Co., Ltd.
2cac7dca0Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License");
3cac7dca0Sopenharmony_ci// you may not use this file except in compliance with the License.
4cac7dca0Sopenharmony_ci// You may obtain a copy of the License at
5cac7dca0Sopenharmony_ci//
6cac7dca0Sopenharmony_ci//     http://www.apache.org/licenses/LICENSE-2.0
7cac7dca0Sopenharmony_ci//
8cac7dca0Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software
9cac7dca0Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS,
10cac7dca0Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11cac7dca0Sopenharmony_ci// See the License for the specific language governing permissions and
12cac7dca0Sopenharmony_ci// limitations under the License.
13cac7dca0Sopenharmony_ci
14cac7dca0Sopenharmony_ci//! build.rs file for ylong_ffrt
15cac7dca0Sopenharmony_ci
16cac7dca0Sopenharmony_ciuse std::path::PathBuf;
17cac7dca0Sopenharmony_ciuse std::{env, fs};
18cac7dca0Sopenharmony_ci
19cac7dca0Sopenharmony_cifn main() {
20cac7dca0Sopenharmony_ci    let library_name = "ffrt";
21cac7dca0Sopenharmony_ci    let root = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
22cac7dca0Sopenharmony_ci    let library_dir = fs::canonicalize(root.join("lib")).unwrap();
23cac7dca0Sopenharmony_ci
24cac7dca0Sopenharmony_ci    println!("cargo:rustc-link-lib={}", library_name);
25cac7dca0Sopenharmony_ci    println!(
26cac7dca0Sopenharmony_ci        "cargo:rustc-link-search=native={}",
27cac7dca0Sopenharmony_ci        env::join_paths([library_dir]).unwrap().to_str().unwrap()
28cac7dca0Sopenharmony_ci    );
29cac7dca0Sopenharmony_ci    println!("cargo:rustc-link-lib=pthread");
30cac7dca0Sopenharmony_ci    println!("cargo:rustc-link-lib=dylib=stdc++");
31cac7dca0Sopenharmony_ci}
32