Skip to content
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

Define APIENTRY in osmesa build if not defined. #407

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

anuraaga
Copy link
Contributor

glew.h undefines APIENTRY and also prevents gl.h from being included by defining its include guard. This means that APIENTRY is not defined within osmesa.h which usually relies on gl.h to define it.

If APIENTRY is not defined when importing osmesa.h, we define it temporarily and then undefine when done. This is similar to the existing workaround for GLAPI which likely exists for the same reason as above. It seems that only clang fails to compile when APIENTRY is not defined, but it seems like it should be defined regardless of compiler or it ends up in the source file. With this change, I can build glew+osmesa for osx without issue.

I have taken a more conservative approach than GLAPI, defining and undefining when done. Maybe it's overkill, let me know.

I ran into this through the VTK project. So the testing I have done is with a VTK build using conda, it works fine.

https://github.com/FoundationLLM/vtk-feedstock/blob/main/recipe/patches/define-apientry-osmesa-osx.patch

@nigels-com
Copy link
Owner

Looks good to me. Thanks for the patch.

@nigels-com nigels-com merged commit c050e33 into nigels-com:master Apr 24, 2024
1 check passed
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.

None yet

2 participants