From d8f2a01f42a8e0f8141a4d2a5e93aaa8262bd539 Mon Sep 17 00:00:00 2001 From: vanfanel Date: Wed, 7 Apr 2021 01:32:19 +0200 Subject: [PATCH] Add GLVND OpenGL detection as a GLX(X11) alternative and remove the glut header. --- CMakeLists.txt | 12 +++++++++++- src/main.hpp | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5a9a38bc..3b12acf42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,7 +234,17 @@ IF (APPLE) find_package(SDL2_ttf REQUIRED) find_package(IOKit REQUIRED) ELSE (APPLE) - find_package(OpenGL REQUIRED) + + find_package(OpenGL QUIET) + IF(OpenGL_FOUND) + message(STATUS "Using OpenGL GLX for OpenGL") + ELSE(OpenGL_FOUND) + # If we couldn't find old GLX package, try to use modern libglvnd libOpenGL.so instead. + message(STATUS "Using GLVND for OpenGL") + FIND_LIBRARY(OpenGL_LIBRARY OpenGL) + SET(EXTRA_LIBS ${OpenGL_LIBRARY}) + ENDIF(OpenGL_FOUND) + IF(NOT WIN32) INCLUDE(FindPkgConfig) PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2) diff --git a/src/main.hpp b/src/main.hpp index 5f62c08ff..59f70673e 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -116,7 +116,6 @@ extern bool autoLimbReload; #ifndef NINTENDO #define GL_GLEXT_PROTOTYPES #include - #include #endif #include #include "SDL_opengl.h"