in you CMakeLists define a auto driver:
if (UNIX AND NOT APPLE)
target_compile_definitions(KLIK PRIVATE SDL_VIDEO_DRIVER_X11 SDL_VIDEO_DRIVER_WAYLAND)
elseif (WIN32)
target_compile_definitions(KLIK PRIVATE SDL_VIDEO_DRIVER_WINDOWS)
elseif (APPLE)
target_compile_definitions(KLIK PRIVATE SDL_VIDEO_DRIVER_COCOA)
endif()
NB: KLIK is my EXECUTABLE OR CUSTOM LIBRAIRIES
and in your main file :
bgfx::PlatformData pd{};
if (wmi.subsystem == SDL_SYSWM_X11)
{
pd.ndt = wmi.info.x11.display;
pd.nwh = (void*)(uintptr_t) wmi.info.x11.window;
}
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
else if (wmi.subsystem == SDL_SYSWM_WAYLAND)
{
pd.ndt = wmi.info.wl.display;
pd.nwh = wmi.info.wl.surface;
}
#endif
else
{
return false;
}
bgfx::setPlatformData(pd);
Top comments (0)