mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00

This allows setting the RUST_FONTCONFIG_DLOPEN environment variable to dlopen fontconfig at runtime rather than linking it at build time. This is helpful for cross compiling to Linux, particularly because fontconfig has lots of C dependencies. Building a vendored copy of fontconfig does not work as expected: https://github.com/slint-ui/slint/issues/88
20 lines
956 B
Rust
20 lines
956 B
Rust
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
|
|
|
use cfg_aliases::cfg_aliases;
|
|
|
|
fn main() {
|
|
// Setup cfg aliases
|
|
cfg_aliases! {
|
|
enable_skia_renderer: { any(feature = "renderer-winit-skia", feature = "renderer-winit-skia-opengl")},
|
|
skia_backend_opengl: { any(feature = "renderer-winit-skia-opengl", all(feature = "renderer-winit-skia", not(any(target_os = "macos", target_family = "windows", target_arch = "wasm32")))) },
|
|
skia_backend_metal: { all(target_os = "macos", not(feature = "renderer-winit-skia-opengl")) },
|
|
skia_backend_d3d: { all(target_family = "windows", not(feature = "renderer-winit-skia-opengl")) },
|
|
}
|
|
|
|
println!("cargo:rerun-if-env-changed=RUST_FONTCONFIG_DLOPEN");
|
|
let dlopen = std::env::var("RUST_FONTCONFIG_DLOPEN").is_ok();
|
|
if dlopen {
|
|
println!("cargo:rustc-cfg=feature=\"fontconfig-dlopen\"");
|
|
}
|
|
}
|