slint/api/sixtyfps-rs/sixtyfps-macros/build.rs
Olivier Goffart 7821926002 Rust: defaults to the native style when Qt is available
This requires some gymnastics to get right as the information
need to be passed to the compiler despite having no direct dependency
between the compiler and the runtime or backends.
So use a file in the build directory to tell the default style

cc: #83
2021-07-28 16:57:09 +02:00

21 lines
945 B
Rust

/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
use std::path::Path;
fn main() {
// This file is written by the sixtyfps-rendering-backend-default's built script. At this point
// the build script might not have ran yet, but we just need to pass the path to the build directory
// to the macro crate itself.
let out_dir = std::env::var_os("OUT_DIR").unwrap();
let target_path =
Path::new(&out_dir).parent().unwrap().parent().unwrap().join("SIXTYFPS_DEFAULT_STYLE.txt");
println!("cargo:rustc-env=SIXTYFPS_DEFAULT_STYLE_PATH={}", target_path.display());
}