use separate handin profile

This commit is contained in:
Michael Zhang 2023-02-15 18:58:10 -06:00
parent b915006848
commit dfec6ccd24
7 changed files with 17 additions and 14 deletions

View file

@ -8,6 +8,12 @@ edition = "2021"
[profile.release] [profile.release]
debug = true debug = true
# Optimize for size when creating handin
[profile.release-handin]
inherits = "release"
strip = true
lto = true
[[bin]] [[bin]]
name = "raytracer1b" name = "raytracer1b"
path = "src/main.rs" path = "src/main.rs"

View file

@ -10,7 +10,7 @@ CONVERT := convert
HANDIN := hw1b.michael.zhang.zip HANDIN := hw1b.michael.zhang.zip
BINARY := ./raytracer1b BINARY := ./raytracer1b
WRITEUP := writeup.pdf WRITEUP := writeup.pdf
SOURCES := $(shell find -name "*.rs") SOURCES := Cargo.toml $(shell find -name "*.rs")
EXAMPLES := $(shell find examples -name "*.txt") EXAMPLES := $(shell find examples -name "*.txt")
EXAMPLES_PPM := $(patsubst %.txt,%.ppm,$(EXAMPLES)) EXAMPLES_PPM := $(patsubst %.txt,%.ppm,$(EXAMPLES))
@ -28,8 +28,8 @@ $(BINARY): $(SOURCES)
-w /usr/src/myapp \ -w /usr/src/myapp \
-e CARGO_TARGET_DIR=/usr/src/myapp/target/docker \ -e CARGO_TARGET_DIR=/usr/src/myapp/target/docker \
rust \ rust \
cargo build --release cargo build --profile release-handin
mv target/release/raytracer1b $@ mv target/docker/release-handin/raytracer1b $@
$(HANDIN): $(BINARY) $(WRITEUP) Makefile Cargo.toml Cargo.lock README.md $(EXAMPLES_PNG) $(EXAMPLES_PPM) $(HANDIN): $(BINARY) $(WRITEUP) Makefile Cargo.toml Cargo.lock README.md $(EXAMPLES_PNG) $(EXAMPLES_PPM)
$(ZIP) -r $@ src examples $^ $(ZIP) -r $@ src examples $^

View file

@ -4,7 +4,7 @@
Writeup is located at `/writeup.pdf`. Writeup is located at `/writeup.pdf`.
The binary can be found at `/assignment-1`. Run `./assignment-1 --help` to see The binary can be found at `/raytracer1b`. Run `./raytracer1b --help` to see
how to use it. The binary has been built using the Rust Docker image, which how to use it. The binary has been built using the Rust Docker image, which
should have an environment similar to CSELabs. If there is trouble running the should have an environment similar to CSELabs. If there is trouble running the
binary, try building from source, as documented below. binary, try building from source, as documented below.

View file

@ -1,4 +1,4 @@
#![doc = include_str!("../writeup.md")] #![doc = include_str!("../README.md")]
#[macro_use] #[macro_use]
extern crate anyhow; extern crate anyhow;

View file

@ -1,16 +1,13 @@
use std::fs::File; use std::fs::File;
use std::path::PathBuf; use std::path::PathBuf;
use anyhow::{ensure, Result}; use anyhow::{Result};
use assignment_1b::image::Image; use assignment_1b::image::Image;
use assignment_1b::ray::Ray; use assignment_1b::ray::Ray;
use assignment_1b::scene::Scene; use assignment_1b::scene::Scene;
use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
use clap::Parser; use clap::Parser;
use rand::{
rngs::{StdRng, ThreadRng},
thread_rng, Rng, RngCore, SeedableRng,
};
use rayon::prelude::{IntoParallelIterator, ParallelIterator}; use rayon::prelude::{IntoParallelIterator, ParallelIterator};
/// Simple raycaster. /// Simple raycaster.

View file

@ -5,7 +5,7 @@ use ordered_float::NotNan;
use crate::ray::Ray; use crate::ray::Ray;
use crate::utils::compute_rotation_matrix; use crate::utils::compute_rotation_matrix;
use super::{data::ObjectKind, illumination::IntersectionContext}; use super::{illumination::IntersectionContext};
#[derive(Debug)] #[derive(Debug)]
pub struct Cylinder { pub struct Cylinder {
@ -181,7 +181,7 @@ impl Cylinder {
mod tests { mod tests {
use nalgebra::Vector3; use nalgebra::Vector3;
use crate::{ray::Ray, scene::data::ObjectKind}; use crate::{ray::Ray};
use super::Cylinder; use super::Cylinder;

View file

@ -4,7 +4,7 @@ use ordered_float::NotNan;
use crate::{ray::Ray, utils::min_f64}; use crate::{ray::Ray, utils::min_f64};
use super::{data::ObjectKind, illumination::IntersectionContext}; use super::{illumination::IntersectionContext};
#[derive(Debug)] #[derive(Debug)]
pub struct Sphere { pub struct Sphere {