forked from microsoft/msquic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
37 lines (31 loc) · 1.1 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use cmake::Config;
use std::path::Path;
use std::env;
fn main() {
let path_extra = "lib";
let mut logging_enabled = "off";
if cfg!(windows) {
logging_enabled = "on";
}
let target = env::var("TARGET").unwrap();
// Builds the native MsQuic and installs it into $OUT_DIR.
let mut config = Config::new(".");
config
.define("QUIC_ENABLE_LOGGING", logging_enabled)
.define("QUIC_TLS", "openssl")
.define("QUIC_OUTPUT_DIR", "../lib");
match target.as_str() {
"x86_64-apple-darwin" => config
.define("CMAKE_OSX_ARCHITECTURES", "x86_64")
.define("CMAKE_OSX_DEPLOYMENT_TARGET", "10.15"),
"aarch64-apple-darwin" => config
.define("CMAKE_OSX_ARCHITECTURES", "arm64")
.define("CMAKE_OSX_DEPLOYMENT_TARGET", "11.0"),
_ => &mut config
};
let dst = config.build();
let lib_path = Path::join(Path::new(&dst), Path::new(path_extra));
println!("cargo:rustc-link-search=native={}", lib_path.display());
}