// 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. fn main() { println!( "cargo::rustc-check-cfg=cfg(backend)" ); 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(); if [ wayland, android, web ].iter().filter( |on| **on ).count() > 1 { panic!( "ltk: the `wayland`, `android` and `web` features are exclusive; build another backend with `default-features = false, features = [ \"android\" ]` or `[ \"web\" ]`" ); } 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 wayland || android || web { println!( "cargo::rustc-cfg=backend" ); } }