Skip to content

Commit

Permalink
Fix linkage against modern GLVND OpenGL implementation on GNU/Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
vanfanel committed May 22, 2024
1 parent aa97e2a commit ffc917c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmake/ncine_compiler_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,8 @@ else() # GCC and LLVM
target_link_libraries(${NCINE_APP} PRIVATE dl)
endif()
endif()

if(NOT ANDROID AND NOT APPLE)
target_link_libraries(${NCINE_APP} PUBLIC ${OpenGL_LIBRARY})
endif()
endif()
10 changes: 9 additions & 1 deletion cmake/ncine_imported_targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,15 @@ elseif(NOT ANDROID AND NOT NCINE_BUILD_ANDROID) # GCC and LLVM
find_package(GLEW)
endif()
if(NOT NINTENDO_SWITCH)
find_package(OpenGL REQUIRED)
find_package(OpenGL QUIET)
if(OpenGL_FOUND)
message(STATUS "Using legacy GLX OpenGL implementation")
else(OpenGL_FOUND)
# If we couldn't find old GLX package, try to use modern libglvnd libOpenGL.so instead.
message(STATUS "Using modern GLVND OpenGL implementation")
FIND_LIBRARY(OpenGL_LIBRARY OpenGL)
SET(EXTRA_LIBS ${OpenGL_LIBRARY})
endif(OpenGL_FOUND)
endif()
if(NCINE_ARM_PROCESSOR)
include(check_atomic)
Expand Down

0 comments on commit ffc917c

Please sign in to comment.