mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-29 18:07:08 +00:00
Support off-screen mode
This commit is contained in:
parent
23b9557df8
commit
6940c54fc1
@ -31,6 +31,7 @@ include("GeneratePkgConfig.cmake")
|
|||||||
option(glew-cmake_BUILD_SHARED "Build the shared glew library" ON)
|
option(glew-cmake_BUILD_SHARED "Build the shared glew library" ON)
|
||||||
option(glew-cmake_BUILD_STATIC "Build the static glew library" ON)
|
option(glew-cmake_BUILD_STATIC "Build the static glew library" ON)
|
||||||
option(USE_GLU "Use GLU" OFF)
|
option(USE_GLU "Use GLU" OFF)
|
||||||
|
option(GLEW_OSMESA "Off-screen Mesa mode" OFF)
|
||||||
option(PKG_CONFIG_REPRESENTATIVE_TARGET "Generate pc file for specified target as glew. libglew_static|libglew_shared" OFF)
|
option(PKG_CONFIG_REPRESENTATIVE_TARGET "Generate pc file for specified target as glew. libglew_static|libglew_shared" OFF)
|
||||||
option(ONLY_LIBS "Do not build executables" OFF)
|
option(ONLY_LIBS "Do not build executables" OFF)
|
||||||
|
|
||||||
@ -81,39 +82,41 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND pc_requires gl)
|
list(APPEND pc_requires gl)
|
||||||
if(POLICY CMP0072)
|
if(USE_NAMESPACED_LIB)
|
||||||
# GLVND
|
list(APPEND LIBRARIES OpenGL::GL)
|
||||||
if(USE_NAMESPACED_LIB)
|
|
||||||
list(APPEND LIBRARIES OpenGL::GL)
|
|
||||||
if(NOT (WIN32 OR APPLE))
|
|
||||||
list(APPEND LIBRARIES OpenGL::GLX)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
list(APPEND LIBRARIES ${OPENGL_opengl_LIBRARY})
|
|
||||||
if(NOT (WIN32 OR APPLE))
|
|
||||||
list(APPEND LIBRARIES ${OPENGL_glx_LIBRARY})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
# Non GLVND
|
list(APPEND LIBRARIES ${OPENGL_opengl_LIBRARY})
|
||||||
if(USE_NAMESPACED_LIB)
|
|
||||||
list(APPEND LIBRARIES OpenGL::OpenGL)
|
|
||||||
else()
|
|
||||||
list(APPEND LIBRARIES ${OPENGL_gl_LIBRARY})
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# OS Specific dependencies
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_library(AGL_LIBRARY AGL)
|
find_library(AGL_LIBRARY AGL REQUIRED)
|
||||||
list(APPEND LIBRARIES ${AGL_LIBRARY})
|
list(APPEND LIBRARIES ${AGL_LIBRARY})
|
||||||
elseif(NOT WIN32)
|
elseif(NOT WIN32)
|
||||||
find_package(X11 REQUIRED)
|
if(GLEW_OSMESA)
|
||||||
|
find_library(OSMESA_LIBRARY OSMesa REQUIRED)
|
||||||
list(APPEND pc_requires x11 xext)
|
list(APPEND LIBRARIES ${OSMESA_LIBRARY})
|
||||||
if(USE_NAMESPACED_LIB)
|
list(APPEND DEFINITIONS -DGLEW_OSMESA)
|
||||||
list(APPEND LIBRARIES X11::X11 X11::Xext)
|
list(APPEND pc_requires osmesa)
|
||||||
else()
|
else()
|
||||||
list(APPEND LIBRARIES ${X11_X11_LIB} ${X11_Xext_LIB})
|
if(NOT OpenGL_GLX_FOUND)
|
||||||
|
message(FATAL_ERROR "GLX is not found. Try with PREFER_GLVND=NO")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(USE_NAMESPACED_LIB)
|
||||||
|
list(APPEND LIBRARIES OpenGL::GLX)
|
||||||
|
else()
|
||||||
|
list(APPEND LIBRARIES ${OPENGL_glx_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
|
||||||
|
list(APPEND pc_requires x11 xext)
|
||||||
|
if(USE_NAMESPACED_LIB)
|
||||||
|
list(APPEND LIBRARIES X11::X11 X11::Xext)
|
||||||
|
else()
|
||||||
|
list(APPEND LIBRARIES ${X11_X11_LIB} ${X11_Xext_LIB})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user