pub fn setup_shader_crate_build()Expand description
Standard build.rs setup that every shader crate should run.
Does three things:
- Emits
cargo::metadata=manifest_dir=<path>so that host crates consuming this shader crate viaKhalBuilder::from_dependencydiscover the shader sources both in-workspace and fromcrates.io-fetched copies. - Declares the
target_arch_is_gpucfg viacargo::rustc-check-cfgso#[cfg(target_arch_is_gpu)]/#[cfg(not(target_arch_is_gpu))]don’t trip theunexpected_cfgslint. - Sets
target_arch_is_gpuwhen compiling for any GPU target (SPIR-V, NVPTX). The host CPU build sees it unset.
Call from build.rs:
khal_std::build_script::setup_shader_crate_build();The shader crate must list khal-std as a [build-dependencies] entry
(in addition to its regular [dependencies] use).