Emscripten WebAssembly triangle sample
Some checks for emscripten were added in cmakelists files and added a sample for WebAssembly, ported from the "Tiny" triangle example.
To generate files:
$ mkdir build-em
$ cd build-em
$ cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE="<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
$ ninja
Please apply cmake-format.
Fun fact, I implemented almost identical example. I'll accept this PR and rebase my another example on top of yours.
@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
I will address all of your suggested changes, and if the end changes are satisfying I suggest they should also be applied to the Tiny.cpp example, because I basically just copied the file and made a few edits for IGL's WebGL integration to work.
@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@jwric I refactored CMakeLists a little bit, can you rebase on top of main and add Triangle.cpp into wasm folder?
@jwric I refactored CMakeLists a little bit, can you rebase on top of main and add Triangle.cpp into wasm folder?
Done, but specifying the shell file as "../samples/wasm/igl.html" doesn't seem to work if you're building in a different folder. I guess it works if you follow the build instructions but still
@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@rudybear merged this pull request in facebook/igl@bffb08ccbf379c2de5ebd91d878c8607f11cd761.