minimal-cmake-emscripten-project
minimal-cmake-emscripten-project copied to clipboard
CMake Emscripten mapping
This repo is awesome btw!
I've had some issues with running the build.
When running make
I get the error: fatal error: 'emscripten/html5.h' file not found
I have my emscripten environment activated as well.
Was able to actually fix that by including
include_directories(
"lib/assimp/include"
"~/emsdk/emscripten/incoming/system/include"
)
In the CMakeLists.txt
However, getting the error: emsdk/emscripten/incoming/system/include/emscripten/val.h:177:9: error: static_assert failed
"GenericWireType must be 8 bytes"
static_assert(sizeof(GenericWireType) == 8, "GenericWireType must be 8 bytes");
Did you specify CMAKE_TOOLCHAIN_FILE=path/to/emscripten/emscripten/version/cmake/Modules/Platform/Emscripten.cmake
variable while running cmake? It should automatically include all the things required by emscripten.
Yes, but I got it working by using these commands
mkdir build && cd build
emconfigure cmake ..
emmake make
I'm new to this but seems like this does the same thing as the CMAKE_TOOLCHAIN_FILE
you mentioned.
The only thing not working for me is the embind part, the bindings get hashed in the JS output (e.g. __ZN11Application8SayHelloEv
). Are you experiencing this as well or do I have a faulty setup?
So it looks the issue for me is when the --preload-file ${CMAKE_SOURCE_DIR}/assets
property is used. When removed everything works as expected.