shitty tarball rule

ecs
q3k 2020-03-16 01:30:36 +01:00
parent a792b18eb8
commit 021303cc7c
4 changed files with 30 additions and 5 deletions

View File

@ -37,3 +37,14 @@ http_archive(
strip_prefix = "glslang-b0ada80356ca7b560c600b93a596af1331442542",
url = "https://github.com/KhronosGroup/glslang/archive/b0ada80356ca7b560c600b93a596af1331442542.tar.gz",
)
http_archive(
name = "rules_pkg",
urls = [
"https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz",
],
sha256 = "352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a",
)
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()

View File

@ -1,4 +1,5 @@
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
rust_binary(
name = "engine",
@ -36,3 +37,13 @@ rust_binary(
"//engine/shaders:forward_frag",
],
)
pkg_tar(
name = "demo",
srcs = [
":engine",
"//engine/shaders:forward_vert",
"//engine/shaders:forward_frag",
],
strip_prefix = '/engine',
)

View File

@ -47,9 +47,9 @@ fn main() {
let mut renderer = render::Renderer::initialize();
let mut cubes: Vec<Arc<Object>> = Vec::new();
for x in -10..10 {
for y in -10..10 {
for z in -10..10 {
for x in -20..20 {
for y in -20..20 {
for z in -20..20 {
let transform = cgm::Matrix4::from_translation(cgm::Vector3::new((x as f32)*4.0, (y as f32)*4.0, (z as f32)*4.0));
let cube = render::renderable::Object {
mesh: mesh_cube.clone(),

View File

@ -3,6 +3,7 @@ use std::ffi::CStr;
use std::fs::File;
use std::io::prelude::*;
use std::sync::Arc;
use std::path;
use runfiles::Runfiles;
use vulkano::descriptor::descriptor as vdd;
@ -23,8 +24,10 @@ impl ShaderDefinition {
pub fn load_into(self, device: Arc<vd::Device>) -> Result<LoadedShader, String> {
fn stringify(x: std::io::Error) -> String { format!("IO error: {}", x) }
let r = Runfiles::create().map_err(stringify)?;
let path = r.rlocation(format!("abrasion/engine/shaders/{}", self.name));
let path = match Runfiles::create().map_err(stringify) {
Err(_) => path::Path::new(".").join("shaders").join(self.name.clone()),
Ok(r) => r.rlocation(format!("abrasion/engine/shaders/{}", self.name))
};
log::info!("Loading shader {}", path.to_str().unwrap_or("UNKNOWN"));