Skip to content

Fixed the build for web using CMake.#1452

Merged
raysan5 merged 4 commits intoraysan5:masterfrom
object71:fix-web-cmake-build
Dec 13, 2020
Merged

Fixed the build for web using CMake.#1452
raysan5 merged 4 commits intoraysan5:masterfrom
object71:fix-web-cmake-build

Conversation

@object71
Copy link
Contributor

@object71 object71 commented Dec 8, 2020

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.

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.
@object71
Copy link
Contributor Author

object71 commented Dec 9, 2020

@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"

@raysan5
Copy link
Owner

raysan5 commented Dec 9, 2020

@object71 Nice! Thanks for the improvements! I don't maintain the CMake build system... Maybe @a3f could take a look to them?

@raysan5 raysan5 requested a review from a3f December 9, 2020 16:56
Copy link
Contributor

@a3f a3f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake parts look ok to me.

@raysan5 raysan5 merged commit 6e79476 into raysan5:master Dec 13, 2020
@raysan5
Copy link
Owner

raysan5 commented Dec 13, 2020

@a3f Nice! Thanks for the review!

@object71
Copy link
Contributor Author

@raysan5 Thanks, I'll see to update the documentation on building for web using cmake now.

@object71 object71 deleted the fix-web-cmake-build branch March 7, 2021 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants