Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparing CMakeLists.txt to accept Wayland #114

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,14 @@ if (WIN32 OR ANDROID OR IOS OR EMSCRIPTEN)
elseif (APPLE)
set (USE_XLIB OFF CACHE BOOL "${USE_XLIB_DESCR}")
else()
set (USE_XLIB ON CACHE BOOL "${USE_XLIB_DESCR}")
find_package(Xlib QUIET)
if (XLIB_FOUND)
set (USE_XLIB ON CACHE BOOL "${USE_XLIB_DESCR}")
message(STATUS "Configuring XLIB")
else()
set(USE_WAYLAND)
message(STATUS "Configuring WAYLAND")
endif()
endif()

if (WIN32)
Expand All @@ -448,12 +455,24 @@ else()
endif()

# OpenGL
if (ANDROID OR IOS OR EMSCRIPTEN OR "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set (USE_OPENGL OFF)
set (USE_GLES2 ON)
else()
set (USE_OPENGL ON CACHE BOOL "${USE_OPENGL_DESCR}")
set (USE_GLES2 OFF CACHE BOOL "${USE_GLES2_DESCR}")
# Try to find OpenGL package
if (NOT USE_D3D)
find_package(OpenGL QUIET)
# If GLES is not found, or we enforced GLES but not OpenGL, setup OpenGL
if(OPENGL_FOUND AND (NOT USE_GLES2 OR USE_OPENGL) )
set(USE_OPENGL ON)
set(USE_GLES2 OFF)
message(STATUS "OpenGL found, using OpenGL")
include_directories(${OPENGL_INCLUDE_DIRS})
list(APPEND EXTRA_LIBS ${OPENGL_LIBRARIES})
set(USE_OPENGL ${USE_OPENGL} CACHE BOOL "${USE_OPENGL_DESCR}")
elseif( OPENGLES2_FOUND )
# Either we found no OpenGL, or GLES was enforced
set(USE_OPENGL OFF)
set(USE_GLES2 ON)
message(STATUS "OpenGL ES 2 found, using GLES2")
set(USE_GLES2 ${USE_GLES2} CACHE BOOL "${USE_GLES2_DESCR}")
endif()
endif()

# include the patched or original list of modules
Expand Down
2 changes: 1 addition & 1 deletion src/OpenGl/OpenGl_GraphicDriver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
#include <Aspect_NeutralWindow.hxx>
#endif

#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__) && (!defined(__APPLE__) || defined(HAVE_XLIB))
#if defined(HAVE_XLIB)
#include <X11/Xlib.h> // XOpenDisplay()
#include <GL/glx.h>
#endif
Expand Down
Loading