This repository has been archived by the owner on Jun 8, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
build.rs
52 lines (47 loc) · 1.59 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
#[cfg(target_os = "macos")]
extern crate cc;
fn main() {
manage_docs();
#[cfg(target_os = "macos")]
build_foreground();
check_features();
}
#[cfg(all(
any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"),
not(all(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))
))]
fn manage_docs() {
extern crate lgpl_docs;
const PATH: &str = "src";
const IGNORES: &[&str] = &["lib.rs", "prelude.rs", "rt.rs", "signal.rs"];
lgpl_docs::purge(PATH, IGNORES);
if cfg!(feature = "embed-lgpl-docs") {
lgpl_docs::embed(lgpl_docs::Library::Gtk, PATH, IGNORES);
}
}
#[cfg(any(
all(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"),
not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))
))]
fn manage_docs() {}
#[cfg(target_os = "macos")]
fn build_foreground() {
cc::Build::new()
.file("src/foreground.m")
.compile("foreground");
println!("cargo:rustc-link-lib=framework=AppKit");
println!("cargo:rustc-link-lib=framework=CoreFoundation");
}
fn check_features() {
// The pkg-config file defines a `targets` variable listing the
// various backends that gdk (yes, gdk) was compiled for.
// We extract that and create gdk_backend="x11" and the like
// as configuration variables.
// For reference, the backend set at time of writing consists of:
// x11 win32 quartz broadway wayland
if let Ok(targets) = pkg_config::get_variable("gtk+-3.0", "targets") {
for target in targets.split_whitespace() {
println!("cargo:rustc-cfg=gdk_backend=\"{}\"", target);
}
}
}