Basic RNG

This commit is contained in:
2025-01-04 16:51:07 -05:00
parent 52110f4e29
commit 68890ac229
13 changed files with 93 additions and 116 deletions

View File

@ -3,8 +3,4 @@ name = "flare"
version.workspace = true
edition.workspace = true
[dependencies]
[build-dependencies]
reqwest.workspace = true
zip-extract.workspace = true
[dependencies]

View File

@ -1,29 +0,0 @@
use std::env;
use std::fs::{File};
use std::io::{BufReader, Write};
use std::path::PathBuf;
use std::process::Command;
pub fn main() {
/*
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=../shader");
let url = "https://github.com/shader-slang/slang/releases/download/v2024.17/slang-2024.17-linux-x86_64.zip";
let output_path = PathBuf::from(format!("{}/slang.zip", env::var("OUT_DIR").unwrap()));
let output_dir = PathBuf::from(format!("{}/slang", env::var("OUT_DIR").unwrap()));
let mut response = reqwest::blocking::get(url).expect("Unable to fetch shader compiler");
let mut response_out = File::create(&output_path).unwrap();
response.copy_to(&mut response_out).expect("Unable to copy file");
response_out.flush().expect("Unable to flush output file");
let response_out = File::open(output_path).expect("Unable to create output file");
let output_reader = BufReader::new(response_out);
zip_extract::extract(output_reader, output_dir.as_path(), true).expect("Unable to extract shader compiler");
let slangc_path = output_dir.join("bin/slangc");
let shader_path= PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("../../shader");
*/
}

View File

@ -1,3 +1,5 @@
use std::path::PathBuf;
use crate::flags::ShaderTest;
use crate::slang_build::SlangBuild;
use xshell::Shell;
@ -18,11 +20,11 @@ impl ShaderTest {
let build_dir = build_dir.to_str().unwrap();
// slang-test currently relies on a folder named `tests/` in the current directory
sh.cmd("cp")
.arg("-r")
.arg("shader-tests")
.arg(format!("{build_dir}/tests"))
.run()?;
let tests_dir = PathBuf::from(format!("{build_dir}/tests"));
sh.cmd("rm").arg("-rf").arg(&tests_dir).run()?;
sh.create_dir(&tests_dir)?;
sh.cmd("cp").arg("-r").arg("shader").arg(tests_dir).run()?;
let _dir_guard = sh.push_dir(&build_dir);
sh.cmd(format!("Release/bin/slang-test"))

View File

@ -54,8 +54,8 @@ impl SlangBuild {
.args(["-S", source_dir.to_str().unwrap()])
.args(["-B", build_dir.to_str().unwrap()])
.arg("-DCMAKE_BUILD_TYPE=Release")
// https://github.com/shader-slang/slang/issues/5832#issuecomment-2533324982
.arg("-DCMAKE_SKIP_INSTALL_RULES=ON")
.arg("-DCMAKE_C_FLAGS=-Wno-stringop-overflow")
.arg("-DCMAKE_CXX_FLAGS=-Wno-stringop-overflow")
.run()
.context("slang-build configure")?;