This is the general-purpose raylib project template in C++.
- Pull all the necessary submodules:
git submodule update --init
- Create a binary diretory:
mkdir bin
cd bin
- Use the following command:
cmake ..
- Pull all the necessary submodules:
git submodule update --init
- Go to the emscripten submodule:
cd lib/emsdk
- Install and activate the emsdk following the Installation Instruction:
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
cd ../..
- Create a binary diretory:
mkdir bin
cd bin
- Use the following commands:
emcmake cmake .. -DPLATFORM=Web
emmake make
(WARNING: if those commands returns an error, make sure that your project is set correctly: directory relations are correct, path to the shell file is correct, path to the resources is correct, resources directory exists etc.)
- To test your final executable (*.html, *.json, *.wasm, *.data, *.mem) you can use the following command:
emrun ./{game_title}.html
NOTE: This CMake workflow is managed from the position of the binary directory; if you want to use CMake from the main project's directory, modify the CMake file respectively (mainly: --shell-file
and --preload-file
).
This template is originally under the MIT Licence, but you can modify it to suite your needs. You can use licenses/license-templates to get the free licence template.