I hope you like it and let's get started
Environment Specification
I am using Ubuntu 16.04 LTS with standard build tools for C/C++.
$ sudo apt-get install build-essential cmake python git
Compiling the Tools
We need to install toolchain for the firstime for C/C++ language.
$
git clone https://github.com/juj/emsdk.git
$ cd emsdk
$
./emsdk install --build=Release sdk-incoming-64bit binaryen-master-64bit
$
./emsdk activate --build=Release sdk-incoming-64bit binaryen-master-64bit
$
source ./emsdk_env.sh --build=Release
$ echo "
source $(pwd)/emsdk_env.sh --build=Release > /dev/null" >> ~/.bashrc
This processes require disk space and take a while for compiling process.
compiling result
Compiling 'Hello World'
Let's start to write code in C/C++ language.(in my case, I will use C++)
$ touch hello.cpp
#include<iostream>
int main() { std::cout << "Hello World" << std::endl; return 0; }
Compile it
$ em++ hello.cpp -s WASM=1 -o hello.html
After compiling, it will result hello.html, hello.js and hello.wasm files.
For hello.wasm will contain the compiled code.
Run it
$ emrun hello.html --port 8080
This will start and open browser to see the result
result Hello World
Thank you
Other Topics:
How to build NGINX RTMP module, Setup Live Streaming with NGINX RTMP module, Publishing Stream with Open Broadcaster Software (OBS), Create Adaptive Streaming with NGINX RTMP, Implementing Filtergraph in Streaming with NGINX RTMP, How to Implement Running Text in Streaming with NGINX RTMP, How to build OpenSceneGraph with Code::Blocks, How to build OpenSceneGraph with Visual Studio 2010, Building Geometry Model, How to run OpenSceneGraph with Netbean IDE 8.2 C++, Rendering Basic Shapes, Using OSG Node to Load 3D Object Model, Rendering 3D Simulator with OpenSceneGraph, How to compile wxWidgets with Visual Studio 2010, How to Setup Debugging in Golang with Visual Code
No comments:
Post a Comment