-
-
Notifications
You must be signed in to change notification settings - Fork 689
CMake: Fix missing -sUSE_PTHREADS=1 in web build #1869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
These changes make sense to me. I tested, and the command line shown via --verbose looks good.
However, could you change the commit message to specifically refer to what this does rather than the Godot issue? Like, "CMake: Fix missing -sUSE_PTHREADS=1 in web build" or something like that
This unfortunatley makes it that any project added for emscripten needs the include injection variable set prior to its definion.
set(CMAKE_PROJECT_<my project name goes here>_INCLUDE ${godot-cpp_SOURCE_DIR}/cmake/emsdkHack.cmake)
So, are you saying this is something we'll need to document that developers need to add to their projects?
- add -sUSE_PTHREADS=1 to link flags - add =1 to sSIDE_MODULE=1 in compile flags to match scons.
|
updated the commit message.
Yes, this is the case, and it's entirely unavoidable due to the way cmake works. If it were something I could fix I would eliminate it as a problem. I feel like a guide for consumers is necessary at this point, though I don't know where I would put it. |
|
Thanks!
We have a section in the docs for Emscripten with CMake - we could document it there? |
Yeah I guess, that whole document is written from the perspective of us godot-cpp devs compiling godot-cpp, not a consumer setting up cmake for thier project, hence my hesitation. |
Hm, I always thought of that documentation as being for consumers using the CMake configuration in their project, with a few notes for godot-cpp contributors (for example, how to build the tests). We should probably revamp it to actually be that! |
@lechaosx identified an issue with compiling for web using cmake in issue #1830
This led me to discover that there was a mising flag (
-sUSE_PTHREADS=1) during the link stage that prevented godot from loading the library if threads were enabled.This PR adds the missing flag, and adds a tiny change which brings it inline with scons.
The other proposed changes to cache the values of the emsdkHack.cmake are not going to solve the inclusion problem, as the special case for emscripten is that the values need to be injected as part of the project instantiation. This unfortunatley makes it that any project added for emscripten needs the include injection variable set prior to its definion.