File: build.rs

package info (click to toggle)
rust-rust-lzma 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: makefile: 4
file content (25 lines) | stat: -rw-r--r-- 667 bytes parent folder | download
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
use std::env;

fn main() {
    let target = env::var("TARGET").unwrap();
    let is_windows = target.contains("windows");
    let statik = env::var("CARGO_FEATURE_STATIC").is_ok();

    if is_windows {
        #[cfg(windows)]
        vcpkg::Config::new()
            .emit_includes(true)
            .find_package("liblzma")
            .expect("Could not find liblzma using vcpkg");
    } else {
        #[cfg(not(windows))]
        pkg_config::Config::new()
            .statik(statik)
            .probe("liblzma")
            .expect("Could not find liblzma using pkg-config");
    }

    if statik {
        println!("cargo:rustc-link-lib=static=lzma");
    }
}