Glfw platform macros not set
I had some trouble with glfwCreateWindowWGPUSurface() returning nullptr, and after debugging found that the internal switch was falling through to L178 in glfw3webgpu.c because none of the platform macros had been defined. Manually adding the appropriate one for my platformed allowed the function to perform correctly.
What is supposed to define those? I do not see them anywhere in the glfw3 header or anything about them in the instructions. I'm on OSX Sequoia 15.6.1; glfw3 was installed with homebrew; I am using Dawn as a backend, and my project sets pkg-config --cflags --libs --static glfw3. I am not using CMake.
If there is a necessary extra build step, could this be added to the documentation?
My students have this same problem on Windows. I don't have this issue on macOS 15.6.1). These macros were removed in the latest commit to glfw3webgpu: https://github.com/eliemichel/glfw3webgpu/commit/8f14534e79c590e8a7f7795ea42e01bedea9e137. It works again if you instead use the previous commit fdcabcc54b56b50c12c10f5317abf8ae7ac32c29. We install GLFW 3.4 and glfw3webgpu via
FetchContent_Declare(
glfw3
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.4
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable( glfw3 )
FetchContent_Declare(
glfw3webgpu
GIT_REPOSITORY https://github.com/eliemichel/glfw3webgpu
GIT_TAG fdcabcc54b56b50c12c10f5317abf8ae7ac32c29
# GIT_TAG 8f14534e79c590e8a7f7795ea42e01bedea9e137 ## No more macros.
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable( glfw3webgpu )