-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[port] [contrib.glfw3] Add compile time define #21797
[port] [contrib.glfw3] Add compile time define #21797
Conversation
Failing tests are:
They are unrelated to my changes |
I merged with main branch and now all tests are passing. |
I was able to figure it out, comment removed due to it being unrelated to this PR. |
Could you perhaps just define this, or something like it, in your glfw header? |
Hi @sbc100 I am not sure which header you are talking about:
Maybe there is a 3rd alternative. I suppose I could add and modify // in GLFW/glfw3native.h
#if defined(GLFW_EXPOSE_NATIVE_EMSCRIPTEN)
#define EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3
// also add the definitions that are currently under GLFW/emscripten_glfw3.h here and get rid of this include entirely...
#endif then the calling code would use it like this: #define GLFW_EXPOSE_NATIVE_EMSCRIPTEN
#include <GLFW/glfw3native.h>
#ifdef EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3
... whatever code is specific to the contrib port
#endif I suppose there is still the potential issue that a user could have their own local copy of glfw . But I am open for such an option if you think that is a better avenue. |
I don't have a strong opinion. I seems easy to modify your |
Since this change is isolated to So yes, if you could merge this now so that it unblocks my progress with the other PR in ImGui. And then I can revisit it in another PR later on. Thank you for your feedback and point of view. It is always much appreciated. |
In a project that wants to use my port, the issue is that the user can use either the built-in glfw3 port (
-sUSE_GLFW=3
) or the new one (--use-port=contrib.glfw3
). There is a (somewhat hacky) way to figure out at runtime which port is being used (using theglfwGetVersionString()
call). But there is no compile time way. And since this project does not want to force their user to use the new port, there needs to be a way to distinguish at compile time...Hence this PR which adds the define
EMSCRIPTEN_USE_PORT_CONTRIB_GLFW3
when compiling with the new port.