Add rust-rocket optional dependency.
authorBernie Innocenti <bernie@codewiz.org>
Sun, 2 Jul 2017 15:16:26 +0000 (11:16 -0400)
committerBernie Innocenti <bernie@codewiz.org>
Sun, 2 Jul 2017 15:16:50 +0000 (11:16 -0400)
.gitmodules [new file with mode: 0644]
Cargo.toml
README.md
lib.rs
release_wasm.sh
rust-rocket [new submodule]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..60c990d
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "rust-rocket"]
+       path = rust-rocket
+       url = https://github.com/Darksecond/rust-rocket
index 4e927c4d69de24804b2ec0588608a240f6bac454..ae262eba53dbc0ded5ec43ec27ffbbc606280e7a 100644 (file)
@@ -13,15 +13,20 @@ cgmath = "*"
 glium = "0.16.0"
 glutin = "0.7.4"
 genmesh = "0.4.1"
-image = { version = "0.14.0", features = ["png_codec"] }
+image = { version = "0.14.0", features = ["png_codec"], optional = true }
 libxm = "1.0.0"
 obj = { version = "0.5", features = ["usegenmesh"] }
+rust-rocket = { path = "rust-rocket", optional = true }
 rand = "*"
 sdl2 = "*"
 
-#[replace]
-#"glutin:0.7.4" = { path = "/home/bernie/src/glutin" }
-#"glium:0.16.0" = { path = "/home/bernie/src/glium" }
+[features]
+default = ["rust-rocket", "image"]
+min = []
+
+[replace]
+"glutin:0.7.4" = { path = "/home/bernie/src/glutin" }
+"glium:0.16.0" = { path = "/home/bernie/src/glium" }
 
 [target.armv7-linux-androideabi]
 ar = "$ANDROID_NDK_HOME/arm/bin/arm-linux-androideabi-ar"
index 5754000027ae104f7a1f18d6781e0127bbbab8f2..9be1a310b1af595474c055d6191c836dff1a028e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ I followed these steps to build a native Windows binary:
 
 ### WebAssembly / asm.js
 
-Install emsdk 1.36.14:
+Install emsdk:
 
 ```
 cd ~
diff --git a/lib.rs b/lib.rs
index c7026710cc0a85e03bb67c7ca6985943516a1b0a..eba89b1fb1b776a6702cb365e392fa672c037b69 100644 (file)
--- a/lib.rs
+++ b/lib.rs
@@ -2,8 +2,11 @@ extern crate cgmath;
 #[macro_use(uniform,program,implement_vertex)]
 extern crate glium;
 extern crate glutin;
+#[cfg(feature = "image")]
 extern crate image;
 extern crate libxm;
+#[cfg(feature = "rust_rocket")]
+extern crate rust_rocket;
 extern crate sdl2;
 
 pub mod bounding_box;
@@ -18,6 +21,7 @@ pub use bounding_box::BoundingBox;
 pub use cube::Cube;
 pub use shaded_cube::ShadedCube;
 
+#[cfg(feature = "image")]
 pub fn screenshot(display : &glium::Display) {
     let image: glium::texture::RawImage2d<u8> = display.read_front_buffer();
     let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap();
@@ -26,3 +30,6 @@ pub fn screenshot(display : &glium::Display) {
     image.save(&mut output, image::ImageFormat::PNG).unwrap();
 }
 
+#[cfg(not(feature = "image"))]
+pub fn screenshot(display : &glium::Display) {
+}
index fc6d92644f6785f1ca7c9e092b5a0eafc3d4ce12..bdabb1c7ff9710236d51ec30962a5233c74f5801 100755 (executable)
@@ -1,5 +1,5 @@
 set -e
-cargo rustc --target wasm32-unknown-emscripten --release -- -C link-args='-s USE_SDL=2 --preload-file flora.xm'
+cargo rustc --target wasm32-unknown-emscripten --release --bin mandelwow -- -C link-args='-s USE_SDL=2 --preload-file flora.xm'
 cp -a target/wasm32-unknown-emscripten/release/mandelwow.js .
 cp -a target/wasm32-unknown-emscripten/release/deps/mandelwow-*.{wasm,data} .
 emrun .
diff --git a/rust-rocket b/rust-rocket
new file mode 160000 (submodule)
index 0000000..3ca2cab
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 3ca2caba4878c73bfa4d2d7a36c2f3b943f9888a