https://github.com/ierturk/cmake-emscripten-project
CLion Cmake Emscripten Project
https://github.com/ierturk/cmake-emscripten-project
clion cmake cpp emscripten html javascript nodejs webassembly
Last synced: 3 months ago
JSON representation
CLion Cmake Emscripten Project
- Host: GitHub
- URL: https://github.com/ierturk/cmake-emscripten-project
- Owner: ierturk
- License: other
- Created: 2020-12-07T01:14:52.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-07T02:11:42.000Z (almost 5 years ago)
- Last Synced: 2025-07-05T11:48:00.447Z (3 months ago)
- Topics: clion, cmake, cpp, emscripten, html, javascript, nodejs, webassembly
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CLion Emscripten project
A skeleton ```Cmake``` project to generate ```WASM``` and ```JS``` file and serving with ```HTML```. ```Ubuntu``` ```WSL2``` is used from ```Microsoft``` ```Windows 10 - x64``` machine for testing..## How to use
1. Clone this repo.
2. Install ```Emscripten``` by following steps on [emscripten website](https://emscripten.org/docs/getting_started/downloads.html)
3. In CLion CMAKE setting add ```CMAKE_TOOLCHAIN_FILE=path/to/emscripten/emscripten/version/cmake/Modules/Platform/Emscripten.cmake```
4. Build from ```Clion```
5. It can be run following ways
1. Run in ```Emscripten``` environment with ```emrun Public/index.htm```. OR
2. Open file ```Public/index.htm``` in ```Clion``` then click your faworite browser from upper right corner.
6. In developer tools console of browser you will see the result as ```144```.## Credits
The repo is created from the following references.
1. [Emscripten Installation instructions](https://emscripten.org/docs/getting_started/downloads.html)
2. [Emscripting a C library to Wasm](https://developers.google.com/web/updates/2018/03/emscripting-a-c-library)
3. [Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake](https://gist.github.com/WesThorburn/00c47b267a0e8c8431e06b14997778e4)
4. [Minimal CMake-driven Emscripten project](https://github.com/adevaykin/minimal-cmake-emscripten-project)