1 // Copyright (c) 2023 Huawei Device Co., Ltd.
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13
14 //! This crate depends on Openssl3.0.
15 //! Sets environment variables when use the feature `c_openssl_3_0`.
16 //! Needs export ``OPENSSL_LIB_DIR`` and ``OPENSSL_INCLUDE_DIR``.
17 //! ``OPENSSL_LIB_DIR`` is the path for ``libssl.so`` and ``libcrypto.so``.
18 //! ``OPENSSL_INCLUDE_DIR`` is the path for the Openssl header file.
19
20 use std::env;
21
main()22 fn main() {
23 let lib_dir = env::var("OPENSSL_LIB_DIR");
24 let include_dir = env::var("OPENSSL_INCLUDE_DIR");
25
26 if let Ok(lib_dir) = lib_dir {
27 println!("cargo:rustc-link-lib=ssl");
28 println!("cargo:rustc-link-lib=crypto");
29 println!("cargo:rustc-link-search=native={lib_dir}");
30 }
31
32 if let Ok(include_dir) = include_dir {
33 println!("cargo:include={include_dir}");
34 }
35 }
36