minimal-cmake-emscripten-project icon indicating copy to clipboard operation
minimal-cmake-emscripten-project copied to clipboard

CMake Emscripten mapping

Open opiepj opened this issue 7 years ago • 4 comments

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.

opiepj avatar Oct 30 '17 19:10 opiepj

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");

opiepj avatar Oct 30 '17 19:10 opiepj

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.

adevaykin avatar Oct 30 '17 20:10 adevaykin

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?

opiepj avatar Oct 30 '17 21:10 opiepj

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.

opiepj avatar Oct 30 '17 23:10 opiepj