https://github.com/painfulexistence/cpp-wasm
An example C++ WebAssembly graphics application
https://github.com/painfulexistence/cpp-wasm
Last synced: 8 months ago
JSON representation
An example C++ WebAssembly graphics application
- Host: GitHub
- URL: https://github.com/painfulexistence/cpp-wasm
- Owner: painfulexistence
- License: mit
- Created: 2024-03-19T12:30:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-03T05:06:14.000Z (over 1 year ago)
- Last Synced: 2024-12-31T19:20:26.198Z (9 months ago)
- Language: C++
- Homepage:
- Size: 38.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++ And WebAssembly
[](https://github.com/painfulexistence/cpp-wasm/actions/workflows/ci.yml)


[](https://twitter.com/intent/follow?screen_name=DevLucidum)
This is an example C++ graphics application using vcpkg as its package manager; the codebase can be compiled for both native and Web platforms.
- Package Manager: vcpkg
- Supported Platforms: MacOSX, Web## Getting Started
### Requirements
- [CMake](https://cmake.org/download/)
- [EMSDK](https://emscripten.org/docs/getting_started/downloads.html)### Getting the Source Code
```Shell
# Clone the repository
git clone --recurse-submodules https://github.com/painfulexistence/cpp-wasm && cd cpp-wasm# Bootstrapping the package manager
./vcpkg/bootstrap-vcpkg.sh
```### Building
#### Building for native
```Shell
# Building
cmake -S . -B build # Add -DCMAKE_BUILD_TYPE=release for release build
cmake --build build# Running
./build/main
```
#### Building for WebAssembly
```Shell
# Building
cmake -S . -B build-wasm -DEMSCRIPTEN=ON # Add -DCMAKE_BUILD_TYPE=release for release build
cmake --build build-wasm# Running (open http://localhost:3000/ in your browser)
python -m http.server -d ./build-wasm 3000 # Use your preferred local server
```
### Notes
- I didn't use GLEW because the vcpkg wasm32 port is currently broken