1
0
Fork 0
forked from wry/wry

build.rs: simplify compile-shaders handling

This commit is contained in:
Julian Orth 2025-10-07 16:44:28 +02:00
parent f17800517e
commit 0564cd848d
5 changed files with 8 additions and 37 deletions

View file

@ -1,8 +1,13 @@
mod hash; mod hash;
use {crate::vulkan::hash::unchanged, anyhow::bail, std::process::Command}; use {
crate::vulkan::hash::{ROOT, unchanged},
anyhow::bail,
std::process::Command,
};
pub fn main() -> anyhow::Result<()> { pub fn main() -> anyhow::Result<()> {
println!("cargo:rerun-if-changed={}", ROOT);
if !std::fs::exists("compile-shaders")? { if !std::fs::exists("compile-shaders")? {
return Ok(()); return Ok(());
} }
@ -15,7 +20,7 @@ pub fn main() -> anyhow::Result<()> {
"--manifest-path", "--manifest-path",
"compile-shaders/Cargo.toml", "compile-shaders/Cargo.toml",
"-p", "-p",
"compile-shaders-build-rs", "compile-shaders-compile",
]) ])
.status()?; .status()?;
if !code.success() { if !code.success() {

View file

@ -49,14 +49,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
[[package]]
name = "compile-shaders-build-rs"
version = "0.1.0"
dependencies = [
"anyhow",
"compile-shaders-core",
]
[[package]] [[package]]
name = "compile-shaders-compile" name = "compile-shaders-compile"
version = "0.1.0" version = "0.1.0"

View file

@ -1,6 +1,6 @@
[workspace] [workspace]
resolver = "3" resolver = "3"
members = ["build-rs", "compile", "core", "shaderc-sys"] members = ["compile", "core", "shaderc-sys"]
[patch."crates-io"] [patch."crates-io"]
shaderc-sys.path = "shaderc-sys" shaderc-sys.path = "shaderc-sys"

View file

@ -1,8 +0,0 @@
[package]
name = "compile-shaders-build-rs"
version = "0.1.0"
edition = "2024"
[dependencies]
compile-shaders-core = { path = "../core" }
anyhow = "1.0.99"

View file

@ -1,18 +0,0 @@
use {anyhow::bail, compile_shaders_core::ROOT, std::process::Command};
fn main() -> anyhow::Result<()> {
println!("cargo:rerun-if-changed={}", ROOT);
let code = Command::new("cargo")
.args([
"run",
"--manifest-path",
"compile-shaders/Cargo.toml",
"-p",
"compile-shaders-compile",
])
.status()?;
if !code.success() {
bail!("compile-shaders failed");
}
Ok(())
}