Skip to content

ierturk/Cmake-Emscripten-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  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
  2. Emscripting a C library to Wasm
  3. Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake
  4. Minimal CMake-driven Emscripten project