// SPDX-License-Identifier: LGPL-2.1-only // Copyright (C) 2026 Liberux Labs, S. L. // `cfg( backend )` marks the runtime behind `ltk::run`, which builds when some platform backend does. Each backend defines `ltk::run` and the native platform types, so only one may be enabled. `cfg( queued_sources )` marks the targets whose run loop cannot wait on calloop, so the runtime's timers and channels go through its own queue. fn main() { println!( "cargo::rustc-check-cfg=cfg(backend)" ); println!( "cargo::rustc-check-cfg=cfg(queued_sources)" ); let wayland = std::env::var_os( "CARGO_FEATURE_WAYLAND" ).is_some(); let android = std::env::var_os( "CARGO_FEATURE_ANDROID" ).is_some(); let web = std::env::var_os( "CARGO_FEATURE_WEB" ).is_some(); let windows = std::env::var_os( "CARGO_FEATURE_WINDOWS" ).is_some(); if [ wayland, android, web, windows ].iter().filter( |on| **on ).count() > 1 { panic!( "ltk: the `wayland`, `android`, `web` and `windows` features are exclusive; build another backend with `default-features = false, features = [ \"android\" ]`, `[ \"web\" ]` or `[ \"windows\" ]`" ); } if web && std::env::var( "CARGO_CFG_TARGET_ARCH" ).as_deref() != Ok( "wasm32" ) { panic!( "ltk: the `web` feature builds only for `wasm32-unknown-unknown`" ); } if windows && std::env::var( "CARGO_CFG_TARGET_OS" ).as_deref() != Ok( "windows" ) { panic!( "ltk: the `windows` feature builds only for Windows targets, such as `x86_64-pc-windows-gnu` or `x86_64-pc-windows-msvc`" ); } if wayland || android || web || windows { println!( "cargo::rustc-cfg=backend" ); } if std::env::var( "CARGO_CFG_TARGET_ARCH" ).as_deref() == Ok( "wasm32" ) || windows { println!( "cargo::rustc-cfg=queued_sources" ); } }