Skip to content

Commit

Permalink
Use OpenGL GLVND ABI instead of legacy ABI
Browse files Browse the repository at this point in the history
This commit forces the project to use the vendor-neutral OpenGL loading
library as well as the windowing system agnostic interface to OpenGL.
It should be supported by all target platforms.
  • Loading branch information
hobyst committed Sep 11, 2023
1 parent 6b13b51 commit 788684a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions CMake/Backends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_sources(rmlui_backend_Win32_GL2 INTERFACE
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h"
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_Windows.h"
)
target_link_libraries(rmlui_backend_Win32_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL)
target_link_libraries(rmlui_backend_Win32_GL2 INTERFACE rmlui_backend_common_headers OpenGL::OpenGL OpenGL::EGL)

add_library(rmlui_backend_Win32_VK INTERFACE)
target_sources(rmlui_backend_Win32_VK INTERFACE
Expand Down Expand Up @@ -50,7 +50,7 @@ target_sources(rmlui_backend_X11_GL2 INTERFACE
# be substituted by "X11:X11" in addition to any of the other imported that might
# be required. More info:
# https://cmake.org/cmake/help/latest/module/FindX11.html
target_link_libraries(rmlui_backend_X11_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL ${X11_LIBRARIES})
target_link_libraries(rmlui_backend_X11_GL2 INTERFACE rmlui_backend_common_headers OpenGL::OpenGL OpenGL::EGL ${X11_LIBRARIES})

add_library(rmlui_backend_SDL_GL2 INTERFACE)
target_sources(rmlui_backend_SDL_GL2 INTERFACE
Expand All @@ -60,7 +60,7 @@ target_sources(rmlui_backend_SDL_GL2 INTERFACE
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_SDL.h"
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h"
)
target_link_libraries(rmlui_backend_SDL_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL SDL2::SDL2 GLEW::GLEW SDL2_image::SDL2_image)
target_link_libraries(rmlui_backend_SDL_GL2 INTERFACE rmlui_backend_common_headers OpenGL::OpenGL OpenGL::EGL SDL2::SDL2 GLEW::GLEW SDL2_image::SDL2_image)

add_library(rmlui_backend_SDL_GL3 INTERFACE)
target_sources(rmlui_backend_SDL_GL3 INTERFACE
Expand All @@ -71,7 +71,7 @@ target_sources(rmlui_backend_SDL_GL3 INTERFACE
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h"
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h"
)
target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE rmlui_backend_common_headers OpenGL::GL SDL2::SDL2 SDL2_image::SDL2_image)
target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE rmlui_backend_common_headers OpenGL::OpenGL OpenGL::EGL SDL2::SDL2 SDL2_image::SDL2_image)
if(UNIX)
# The OpenGL 3 renderer implementation uses dlopen/dlclose
# This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime
Expand Down Expand Up @@ -114,7 +114,7 @@ target_sources(rmlui_backend_SFML_GL2 INTERFACE
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h"
)
target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE
rmlui_backend_common_headers OpenGL::GL rmlui_SFML_old_wrapper SFML::Graphics SFML::Window SFML::System
rmlui_backend_common_headers OpenGL::OpenGL OpenGL::EGL rmlui_SFML_old_wrapper SFML::Graphics SFML::Window SFML::System
)
if(WIN32)
target_link_libraries(rmlui_backend_SFML_GL2 INTERFACE SFML::Main)
Expand All @@ -128,7 +128,7 @@ target_sources(rmlui_backend_GLFW_GL2 INTERFACE
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Platform_GLFW.h"
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL2.h"
)
target_link_libraries(rmlui_backend_GLFW_GL2 INTERFACE rmlui_backend_common_headers OpenGL::GL glfw)
target_link_libraries(rmlui_backend_GLFW_GL2 INTERFACE rmlui_backend_common_headers OpenGL::OpenGL OpenGL::EGL glfw)

add_library(rmlui_backend_GLFW_GL3 INTERFACE)
target_sources(rmlui_backend_GLFW_GL3 INTERFACE
Expand All @@ -139,7 +139,7 @@ target_sources(rmlui_backend_GLFW_GL3 INTERFACE
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.h"
"${PROJECT_SOURCE_DIR}/Backends/RmlUi_Include_GL3.h"
)
target_link_libraries(rmlui_backend_GLFW_GL3 INTERFACE rmlui_backend_common_headers OpenGL::GL glfw)
target_link_libraries(rmlui_backend_GLFW_GL3 INTERFACE rmlui_backend_common_headers OpenGL::OpenGL OpenGL::EGL glfw)
if(UNIX)
# The OpenGL 3 renderer implementation uses dlopen/dlclose
# This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime
Expand Down
8 changes: 4 additions & 4 deletions CMake/BackendsDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,16 @@ endif()
# OpenGL handling changes in CMake 3.11, requiring to set CMake policy CMP0072
# More info: https://cmake.org/cmake/help/latest/policy/CMP0072.html
if(RMLUI_SAMPLES_BACKEND MATCHES "GL2$")
find_package("OpenGL" "2")
find_package("OpenGL" "2" COMPONENTS "OpenGL" "EGL")
if(NOT TARGET OpenGL::GL)
report_not_found_dependency("OpenGL" OpenGL::GL)
report_not_found_dependency("OpenGL" OpenGL::OpenGL)
endif()
endif()

if(RMLUI_SAMPLES_BACKEND MATCHES "GL3$")
find_package("OpenGL" "3")
find_package("OpenGL" "3" COMPONENTS "OpenGL" "EGL")
if(NOT TARGET OpenGL::GL)
report_not_found_dependency("OpenGL" OpenGL::GL)
report_not_found_dependency("OpenGL" OpenGL::OpenGL)
endif()
endif()

Expand Down

0 comments on commit 788684a

Please sign in to comment.