Fixed the build for web using CMake.#1452
Conversation
I found that the build for me was failing and I added some if defined checks in the core.c file where the glfwSetWindowAttrib was used. (error: implicit declaration of function 'glfwSetWindowAttrib' is invalid in C99 [-Werror,-Wimplicit-function-declaration]) I also changed some values in the toolchain file so that it correctly uses the .bat files when on windows.
Added the option to use the system provided Emscripten toolchain to be more uniform with other libraries. Fixed and issue which prevented example being built from cmake and also building with html extensions properly.
|
@raysan5 Hi, I made some improvements on the CMakeLists.txt files. The project wasn't build-able for me for web on windows and I decided to improve some of the cmake configurations. I edited some values in the cmake/emscripten.cmake toolchain that is local in the project as on windows it didn't correctly execute the .bat compilers. I added the option to detect EMSCRIPTEN variable set by the emscripten toolchain. The emscripten toolchain is set by default when the emcmake is used before cmake. I fixed an issue with a replace value by putting quotes around it (the value was empty for some reason for me) I fixed the extension filename generation for web to properly generate .html files. Now the process for build web is more straighforward - open terminal in project root and generate with "emcmake cmake -S . -B build -G Ninja" |
|
@a3f Nice! Thanks for the review! |
|
@raysan5 Thanks, I'll see to update the documentation on building for web using cmake now. |
I found that the build for me was failing and I added some if defined checks in the core.c file where the glfwSetWindowAttrib was used. (error: implicit declaration of function 'glfwSetWindowAttrib' is invalid in C99 [-Werror,-Wimplicit-function-declaration])
I also changed some values in the toolchain file so that it correctly uses the .bat files when on windows.