mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Remove compile-time client library selection
This commit is contained in:
parent
1b1ef31228
commit
22eca139fb
@ -59,39 +59,6 @@ endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
|
||||
|
||||
if (GLFW_USE_EGL)
|
||||
set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING
|
||||
"The client library to use; one of opengl, glesv1 or glesv2")
|
||||
|
||||
if (${GLFW_CLIENT_LIBRARY} STREQUAL "opengl")
|
||||
set(_GLFW_USE_OPENGL 1)
|
||||
elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "glesv1")
|
||||
set(_GLFW_USE_GLESV1 1)
|
||||
elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "glesv2")
|
||||
set(_GLFW_USE_GLESV2 1)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported client library")
|
||||
endif()
|
||||
|
||||
find_package(EGL REQUIRED)
|
||||
|
||||
if (NOT _GLFW_USE_OPENGL)
|
||||
set(GLFW_BUILD_EXAMPLES OFF)
|
||||
set(GLFW_BUILD_TESTS OFF)
|
||||
message(STATUS "NOTE: Examples and tests require OpenGL")
|
||||
endif()
|
||||
else()
|
||||
set(_GLFW_USE_OPENGL 1)
|
||||
endif()
|
||||
|
||||
if (_GLFW_USE_OPENGL)
|
||||
find_package(OpenGL REQUIRED)
|
||||
elseif (_GLFW_USE_GLESV1)
|
||||
find_package(GLESv1 REQUIRED)
|
||||
elseif (_GLFW_USE_GLESV2)
|
||||
find_package(GLESv2 REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if (GLFW_BUILD_DOCS)
|
||||
@ -226,6 +193,11 @@ if (UNIX AND NOT APPLE)
|
||||
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
|
||||
list(APPEND glfw_PKG_LIBS "-lm")
|
||||
endif()
|
||||
|
||||
if (CMAKE_DL_LIBS)
|
||||
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
@ -240,16 +212,6 @@ if (_GLFW_WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use WGL for context creation
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_WGL)
|
||||
|
||||
list(APPEND glfw_PKG_LIBS "-lopengl32")
|
||||
|
||||
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use X11 for window creation
|
||||
#--------------------------------------------------------------------
|
||||
@ -361,49 +323,6 @@ if (_GLFW_MIR)
|
||||
list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use GLX for context creation
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_GLX)
|
||||
|
||||
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
|
||||
|
||||
list(APPEND glfw_PKG_DEPS "gl")
|
||||
|
||||
if (CMAKE_DL_LIBS)
|
||||
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use EGL for context creation
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_EGL)
|
||||
|
||||
list(APPEND glfw_INCLUDE_DIRS "${EGL_INCLUDE_DIR}")
|
||||
list(APPEND glfw_LIBRARIES "${EGL_LIBRARY}")
|
||||
|
||||
list(APPEND glfw_PKG_DEPS "egl")
|
||||
|
||||
if (_GLFW_USE_OPENGL)
|
||||
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
|
||||
list(APPEND glfw_PKG_DEPS "gl")
|
||||
elseif (_GLFW_USE_GLESV1)
|
||||
list(APPEND glfw_LIBRARIES "${GLESv1_LIBRARY}")
|
||||
list(APPEND glfw_PKG_DEPS "glesv1_cm")
|
||||
elseif (_GLFW_USE_GLESV2)
|
||||
list(APPEND glfw_LIBRARIES "${GLESv2_LIBRARY}")
|
||||
list(APPEND glfw_PKG_DEPS "glesv2")
|
||||
endif()
|
||||
|
||||
if (CMAKE_DL_LIBS)
|
||||
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use Cocoa for window creation and NSOpenGL for context creation
|
||||
#--------------------------------------------------------------------
|
||||
@ -438,13 +357,12 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
|
||||
CORE_FOUNDATION_FRAMEWORK
|
||||
CORE_VIDEO_FRAMEWORK)
|
||||
list(APPEND glfw_LIBRARIES "${COCOA_FRAMEWORK}"
|
||||
"${OPENGL_gl_LIBRARY}"
|
||||
"${IOKIT_FRAMEWORK}"
|
||||
"${CORE_FOUNDATION_FRAMEWORK}"
|
||||
"${CORE_VIDEO_FRAMEWORK}")
|
||||
|
||||
set(glfw_PKG_DEPS "")
|
||||
set(glfw_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo")
|
||||
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -90,10 +90,7 @@ Once you have Xcode installed, move on to @ref compile_generate.
|
||||
To compile GLFW for X11, you need to have the X11 and OpenGL header packages
|
||||
installed, as well as the basic development tools like GCC and make. For
|
||||
example, on Ubuntu and other distributions based on Debian GNU/Linux, you need
|
||||
to install the `xorg-dev` and `libgl1-mesa-dev` packages. The former pulls in
|
||||
all X.org header packages and the latter pulls in the Mesa OpenGL development
|
||||
packages. Note that using header files and libraries from Mesa during
|
||||
compilation _will not_ tie your binaries to the Mesa implementation of OpenGL.
|
||||
to install the `xorg-dev` package, which pulls in all X.org header packages.
|
||||
|
||||
Once you have installed the necessary packages, move on to @ref
|
||||
compile_generate.
|
||||
@ -183,12 +180,6 @@ library or as a DLL / shared library / dynamic library.
|
||||
is empty, it is installed to `${CMAKE_INSTALL_PREFIX}/lib`. If it is set to
|
||||
`64`, it is installed to `${CMAKE_INSTALL_PREFIX}/lib64`.
|
||||
|
||||
`GLFW_CLIENT_LIBRARY` determines which client API library to use. If set to
|
||||
`opengl` the OpenGL library is used, if set to `glesv1` for the OpenGL ES 1.x
|
||||
library is used, or if set to `glesv2` the OpenGL ES 2.0 library is used. The
|
||||
selected library and its header files must be present on the system for this to
|
||||
work.
|
||||
|
||||
`GLFW_BUILD_EXAMPLES` determines whether the GLFW examples are built
|
||||
along with the library.
|
||||
|
||||
@ -249,8 +240,8 @@ defines `_GLFW_USE_CONFIG_H`, which causes this header to be included by
|
||||
macros to be defined on the command-line.
|
||||
|
||||
Three macros _must_ be defined when compiling GLFW: one selecting the window
|
||||
creation API, one selecting the context creation API and one client library.
|
||||
Exactly one of each kind must be defined for GLFW to compile and link.
|
||||
creation API and one selecting the context creation API. Exactly one of each
|
||||
kind must be defined for GLFW to compile and link.
|
||||
|
||||
The window creation API is used to create windows, handle input, monitors, gamma
|
||||
ramps and clipboard. The options are:
|
||||
@ -271,20 +262,6 @@ configurations and to create contexts. The options are:
|
||||
|
||||
Wayland and Mir both require the EGL backend.
|
||||
|
||||
The client library is the one providing the OpenGL or OpenGL ES API, which is
|
||||
used by GLFW to probe the created context. This is not the same thing as the
|
||||
client API, as many desktop OpenGL client libraries now expose the OpenGL ES API
|
||||
through extensions. The options are:
|
||||
|
||||
- `_GLFW_USE_OPENGL` for the desktop OpenGL (opengl32.dll, libGL.so or
|
||||
OpenGL.framework)
|
||||
- `_GLFW_USE_GLESV1` for OpenGL ES 1.x (experimental)
|
||||
- `_GLFW_USE_GLESV2` for OpenGL ES 2.x (experimental)
|
||||
|
||||
Note that `_GLFW_USE_GLESV1` and `_GLFW_USE_GLESV2` may only be used with EGL,
|
||||
as the other context creation APIs do not interface with OpenGL ES client
|
||||
libraries.
|
||||
|
||||
If you are building GLFW as a shared library / dynamic library / DLL then you
|
||||
must also define `_GLFW_BUILD_DLL`. Otherwise, you may not define it.
|
||||
|
||||
|
@ -72,10 +72,3 @@
|
||||
// Define this to 1 if windows should use full resolution on Retina displays
|
||||
#cmakedefine _GLFW_USE_RETINA
|
||||
|
||||
// Define this to 1 if using OpenGL as the client library
|
||||
#cmakedefine _GLFW_USE_OPENGL
|
||||
// Define this to 1 if using OpenGL ES 1.1 as the client library
|
||||
#cmakedefine _GLFW_USE_GLESV1
|
||||
// Define this to 1 if using OpenGL ES 2.0 as the client library
|
||||
#cmakedefine _GLFW_USE_GLESV2
|
||||
|
||||
|
@ -268,9 +268,7 @@ struct _GLFWwindow
|
||||
int release;
|
||||
} context;
|
||||
|
||||
#if defined(_GLFW_USE_OPENGL)
|
||||
PFNGLGETSTRINGIPROC GetStringi;
|
||||
#endif
|
||||
PFNGLGETINTEGERVPROC GetIntegerv;
|
||||
PFNGLGETSTRINGPROC GetString;
|
||||
PFNGLCLEARPROC Clear;
|
||||
|
Loading…
Reference in New Issue
Block a user