-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.rs
55 lines (46 loc) · 1.6 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use std::env;
fn dynamic_link() {
println!("cargo:rustc-link-lib=jxl");
println!("cargo:rustc-link-lib=jxl_threads");
println!("cargo:rustc-link-lib=hwy");
if let Ok(path) = env::var("DEP_HWY_LIB") {
println!("cargo:rustc-link-search=native={}", path);
}
println!("cargo:rustc-link-lib:+whole-archive=brotlidec");
println!("cargo:rustc-link-lib=brotlienc");
println!("cargo:rustc-link-lib=brotlicommon");
if let Ok(path) = env::var("DEP_BROTLI_LIB") {
println!("cargo:rustc-link-search=native={}", path);
}
}
fn static_link() {
println!("cargo:rustc-link-lib=static=jxl");
println!("cargo:rustc-link-lib=static=jxl_cms");
println!("cargo:rustc-link-lib=static=jxl_threads");
println!("cargo:rustc-link-lib=static=hwy");
if let Ok(path) = env::var("DEP_HWY_LIB") {
println!("cargo:rustc-link-search=native={}", path);
}
println!("cargo:rustc-link-lib=static:+whole-archive=brotlidec");
println!("cargo:rustc-link-lib=static=brotlienc");
println!("cargo:rustc-link-lib=static=brotlicommon");
if let Ok(path) = env::var("DEP_BROTLI_LIB") {
println!("cargo:rustc-link-search=native={}", path);
}
}
fn main() {
// Static link libjxl
#[cfg(all(not(feature = "vendored"), not(feature = "dynamic")))]
static_link();
#[cfg(all(not(feature = "vendored"), feature = "dynamic"))]
dynamic_link();
// Dynamic link c++
#[cfg(target_os = "linux")]
{
println!("cargo:rustc-link-lib=stdc++");
}
#[cfg(target_os = "macos")]
{
println!("cargo:rustc-link-lib=c++");
}
}