Add build instructions for Windows.
[mandelwow.git] / README.md
1 # MandelWow
2
3 ## Overview
4
5 MandelWow is a generalized version of Mandelbrot & Julia in which both C and Z0 vary in a 4-dimensional space.
6 On each frame we render a 3D slice of the MandelWow, varying the remaining dimension through time.
7
8 I wrote this demo to learn Rust & basic GLSL. Mind the mess.
9
10
11 ## Requirements
12
13 The native binary requires OpenGL 3.1. Should perform well on reasonably modern
14 hardware. Tested on Linux with Intel HD Graphics 4000 (Ivy Bridge) and NVidia GTX 970.
15
16 The asmjs and WebAssembly versions were tested on Chromium 57 and Firefox 53.
17
18
19 ## Building from source
20
21 ### Linux
22
23 Install cargo (either your distro's packaged version or via rustup), then go to the source root and type:
24
25 ```
26 cargo run --release
27 ```
28
29 ### Windows
30
31 Mandelwow depends on [libxm](https://github.com/nukep/libxm-rs) and [SDL2](https://github.com/AngryLawyer/rust-sdl2) for sound.
32 Both are tricky to build using Rust's MSVC toolchain because they assume GCC, so I recommend using the GNU toolchain instead.
33 I followed these steps to build a native Windows binary:
34
35 * Install Cargo via [rustup](https://www.rustup.rs).
36 * Install mingw-w64. The [MSYS2](http://www.msys2.org/) installer provides the basic shell environment and the package manager.
37 * From the MSYS2 console, install the W64 native toolchain and libSDL2:
38   ```
39   pacman -Sy
40   pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
41   ```
42 * While you're at it, you may also want to install the git package: `pacman -S git`
43 * I had to manually add the mingw-w64 toolchain to your path:
44   ```
45   export PATH="/mingw64/bin:$PATH"
46   export LIBRARY_PATH=/mingw64/lib
47   ```
48 * In case `cargo` and `rustup` aren't in the shell path, add `$USERPROFILE/.cargo/bin` too.
49 * Next, install the Rust toolchain targeting GCC:
50   ```
51   rustup toolchain install stable-x86_64-pc-windows-gnu
52   rustup default stable-x86_64-pc-windows-gnu
53   ```
54 * Now you can proceed to mandelwow's source tree and build a native Windows binary without further hassles:
55   ```
56   cargo run --release
57   ```
58
59 ### WebAssembly / asm.js
60
61 Install emsdk 1.36.14:
62
63 ```
64 cd ~
65 curl -O https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
66 tar xf emsdk-portable.tar.gz
67 source emsdk-portable/emsdk_env.sh
68 emsdk install emscripten-1.37.9 --build=MinSizeRel
69 emsdk activate emscripten-1.37.9 --build=MinSizeRel
70 ```
71
72 Install rustc:
73
74 ```
75 cd ~
76 curl https://sh.rustup.rs -sSf | sh
77 source ~/.cargo/env
78 rustup toolchain install nightly
79 rustup default nightly
80 rustup target install asmjs-unknown-emscripten
81 rustup target install wasm32-unknown-emscripten
82 ```
83
84 Build and run mandelwow:
85
86 ```
87 cd mandelwow
88 ./release_asmjs.sh
89 ```
90
91 Build the WebAssembly binary:
92
93 ```
94 cd mandelwow
95 ./release_wasm.sh
96 ```
97
98 ## License
99
100 This project is GPL 3.0.
101 The support/ directory contains some code forked from Glium, which was originally Apache 2.0.