Minimal application for wgpu on native platforms (+web)
video.webm
This is an example on how to set up a very minimal native app for Windows and MacOS using wgpu-native as backend. For the native window handling, we use sokol_app.
Just use Cmake to configure your project, and the appropriate binary release of wgpu-native will be automatically downloaded as part of the project setup. Have a look at the CMakeLists.txt file for details.
If you want to use the same code, but targeting the web with emscripten, you can compile on linux, mac, or WSL the project:
cd minimal-wgpu-native
mkdir build
cd build
source $HOME/<path-to-your-emsdk>/emsdk/emsdk_env.sh
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake ..
make -j
You can use Docker to compile the wasm files with a script (buildWASM.py)
cd minimal-wgpu-native/wasm
python3 ./buildWASM.py