-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
24 lines (19 loc) · 796 Bytes
/
build.rs
File metadata and controls
24 lines (19 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#[cfg(feature = "comptime")]
use std::env;
#[cfg(not(feature = "comptime"))]
pub fn main() {}
#[cfg(feature = "comptime")]
pub fn main() {
use slang_hal_build::ShaderCompiler;
const SLANG_SRC_DIR: include_dir::Dir<'_> =
include_dir::include_dir!("$CARGO_MANIFEST_DIR/shaders");
let out_dir = env::var("OUT_DIR").expect("Couldn't determine output directory.");
let mut compiler = ShaderCompiler::new(vec![], &out_dir);
compiler.add_dir(SLANG_SRC_DIR);
// Compile all shaders from examples/shaders directory.
// Note: slang-hal-build will automatically detect which backends to compile for
// based on the cargo features enabled during the build.
compiler
.compile_shaders_dir("shaders", &[])
.expect("Failed to compile shaders");
}