{"id":17305479,"url":"https://github.com/asny/rust_to_js","last_synced_at":"2025-03-26T23:24:10.659Z","repository":{"id":55337454,"uuid":"125212234","full_name":"asny/rust_to_js","owner":"asny","description":"Hello world example in Rust and OpenGL which supports easy compilation to Javascript/WebAssembly and WebGL 2.0 using Emscripten","archived":false,"fork":false,"pushed_at":"2018-04-09T09:36:35.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T05:16:31.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-14T12:54:05.000Z","updated_at":"2023-01-08T05:36:58.000Z","dependencies_parsed_at":"2022-08-14T21:21:40.452Z","dependency_job_id":null,"html_url":"https://github.com/asny/rust_to_js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asny%2Frust_to_js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asny%2Frust_to_js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asny%2Frust_to_js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asny%2Frust_to_js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asny","download_url":"https://codeload.github.com/asny/rust_to_js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245750984,"owners_count":20666279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T11:55:57.198Z","updated_at":"2025-03-26T23:24:10.631Z","avatar_url":"https://github.com/asny.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust_to_js\nHello world example of Rust, OpenGL and SDL2 which supports compilation to JavaScript/WebAssembly and WebGL 2.0.\n\n* Easy compilation for both desktop and web (both WebAssembly and JavaScript)\n* Guarantee that only features supported by WebGL 2.0 is used\n* Possible to preload resources (see https://kripken.github.io/emscripten-site/docs/porting/files/packaging_files.html)\n\n# Installation\n### Rust\n```$ curl https://sh.rustup.rs -sSf | sh```\n\nLogout and in again\n\n(See also https://www.rust-lang.org/en-US/install.html)\n\n### SDL2\n```$ brew install sdl2```\n\n### Emscripten\n```$ cd ~/```\n\n```$ git clone https://github.com/juj/emsdk .emsdk```\n\n```$ cd .emsdk/```\n\n```$ ./emsdk install latest```\n\n```$ ./emsdk activate latest```\n\n```$ source ./emsdk_env.sh```\n\n(See also https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)\n\n### Emscripten + SDL2\n```$ embuilder.py build sdl2``` (It might be necessary to change embuilder.py to use python)\n\n### Emscripten + Rust\n```$ embuilder.py build binaryen``` (It might be necessary to change embuilder.py to use python)\n\n```$ rustup target add asmjs-unknown-emscripten```\n\n```$ rustup target add wasm32-unknown-emscripten```\n\n### rust_to_js\n```$ git clone https://github.com/asny/rust_to_js.git rust_to_js```\n\n# Compilation\ncd to rust_to_js project folder\n\n### Desktop\n```$ cargo run```\n\n### Web\n```$ ./toJS``` or ```$ ./toWasm```\n\n```$ python -m SimpleHTTPServer```\n\nGo to http://localhost:8000/\n\n### Clean\n```$ ./clean```\n\n# Sources:\n- https://blog.fazibear.me/definitive-guide-to-rust-sdl-2-and-emscripten-93d707b22bbb\n- http://nercury.github.io/rust/opengl/tutorial/2018/02/08/opengl-in-rust-from-scratch-00-setup.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasny%2Frust_to_js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasny%2Frust_to_js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasny%2Frust_to_js/lists"}