Skip to content

asny/rust_to_js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust_to_js

Hello world example of Rust, OpenGL and SDL2 which supports compilation to JavaScript/WebAssembly and WebGL 2.0.

Installation

Rust

$ curl https://sh.rustup.rs -sSf | sh

Logout and in again

(See also https://www.rust-lang.org/en-US/install.html)

SDL2

$ brew install sdl2

Emscripten

$ cd ~/

$ git clone https://github.com/juj/emsdk .emsdk

$ cd .emsdk/

$ ./emsdk install latest

$ ./emsdk activate latest

$ source ./emsdk_env.sh

(See also https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)

Emscripten + SDL2

$ embuilder.py build sdl2 (It might be necessary to change embuilder.py to use python)

Emscripten + Rust

$ embuilder.py build binaryen (It might be necessary to change embuilder.py to use python)

$ rustup target add asmjs-unknown-emscripten

$ rustup target add wasm32-unknown-emscripten

rust_to_js

$ git clone https://github.com/asny/rust_to_js.git rust_to_js

Compilation

cd to rust_to_js project folder

Desktop

$ cargo run

Web

$ ./toJS or $ ./toWasm

$ python -m SimpleHTTPServer

Go to http://localhost:8000/

Clean

$ ./clean

Sources:

About

Hello world example in Rust and OpenGL which supports easy compilation to Javascript/WebAssembly and WebGL 2.0 using Emscripten

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published