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
This commit is contained in:
Olivier Goffart 2021-07-28 15:15:10 +02:00 committed by Olivier Goffart
parent 3d1c71b762
commit 7821926002
7 changed files with 82 additions and 0 deletions

View file

@ -340,6 +340,13 @@ pub fn sixtyfps(stream: TokenStream) -> TokenStream {
//println!("{:#?}", syntax_node);
let mut compiler_config =
CompilerConfiguration::new(sixtyfps_compilerlib::generator::OutputFormat::Rust);
if std::env::var_os("SIXTYFPS_STYLE").is_none() {
compiler_config.style = std::fs::read_to_string(env!("SIXTYFPS_DEFAULT_STYLE_PATH"))
.map(|style| style.trim().into())
.ok()
}
compiler_config.include_paths = include_paths;
let (root_component, mut diag) =
spin_on::spin_on(compile_syntax_node(syntax_node, diag, compiler_config));