Skip to content

Commit

Permalink
Skip find_package for OpenGL when not needed. Link again to OpenGL::G…
Browse files Browse the repository at this point in the history
…L when using Emscripten.
  • Loading branch information
mikke89 committed Oct 12, 2024
1 parent 5216dd4 commit 11f2c0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Backends/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ if(UNIX)
# This is required in some UNIX and UNIX-like operating systems to load shared object files at runtime
target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE ${CMAKE_DL_LIBS})
endif()
if(EMSCRIPTEN)
# Only Emscripten requires linking to OpenGL::GL, for other platforms we use 'glad' as an OpenGL loader.
target_link_libraries(rmlui_backend_SDL_GL3 INTERFACE OpenGL::GL)
endif()

add_library(rmlui_backend_SDL_VK INTERFACE)
target_sources(rmlui_backend_SDL_VK INTERFACE
Expand Down
4 changes: 3 additions & 1 deletion CMake/DependenciesForBackends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ if(RMLUI_BACKEND MATCHES "GL2$")
report_dependency_found_or_error("OpenGL" OpenGL::GL)
endif()

if(RMLUI_BACKEND MATCHES "GL3$")
# We use 'glad' as an OpenGL loader for GL3 backends, thus we don't normally need to link to OpenGL::GL. The exception
# is for Emscripten, where we use a custom find module to provide OpenGL support.
if(EMSCRIPTEN AND RMLUI_BACKEND MATCHES "GL3$")
find_package("OpenGL" "3")
report_dependency_found_or_error("OpenGL" OpenGL::GL)
endif()

0 comments on commit 11f2c0a

Please sign in to comment.