2022-07-15 15:37:19 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(GLEW)
|
|
|
|
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
|
Linux: update GLEW to 2.2.0, and enable EGL support in GLEW to match wxWidgets
On Linux, wxGTK by default attempts to use EGL if it is available on the
system, rather than GLX. Unfortunately, the ancient version of GLEW that we
packaged in did not support EGL, and even if it did, the configuration was
not set up to enable EGL. To solve this, we:
* upgrade GLEW to version 2.2.0, from upstream GitHub
* modify the Bambu build process to enforce that we use GLEW from the
built dependency
* remove the "extra" even older GLEW that was packaged
* modify GLEW's CMake configuration to enable EGL support when it is
available on the system (using the same test as wxWidgets uses to decide
whether to enable EGL support); if EGL isn't available at compile time,
both GLEW and wxWidgets will fall back on GLX
Note that you probably will have to blow away your CMakeCache for this to
work correctly -- otherwise, you may end up with the system GLEW, if you
have one installed (which is probably not what you want -- on Ubuntu, the
system GLEW is GLX, not EGL).
2023-01-11 09:09:57 +00:00
|
|
|
if(OpenGL_EGL_FOUND)
|
|
|
|
message(STATUS "building GLEW for EGL (hope that wxWidgets agrees, otherwise you won't have any output!)")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGLEW_EGL")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(GLEW src/glew.c)
|
|
|
|
target_include_directories(GLEW PRIVATE include/)
|
|
|
|
target_link_libraries(GLEW PUBLIC OpenGL::GL)
|
2022-07-15 15:37:19 +00:00
|
|
|
|
|
|
|
if (NOT BUILD_SHARED_LIBS)
|
Linux: update GLEW to 2.2.0, and enable EGL support in GLEW to match wxWidgets
On Linux, wxGTK by default attempts to use EGL if it is available on the
system, rather than GLX. Unfortunately, the ancient version of GLEW that we
packaged in did not support EGL, and even if it did, the configuration was
not set up to enable EGL. To solve this, we:
* upgrade GLEW to version 2.2.0, from upstream GitHub
* modify the Bambu build process to enforce that we use GLEW from the
built dependency
* remove the "extra" even older GLEW that was packaged
* modify GLEW's CMake configuration to enable EGL support when it is
available on the system (using the same test as wxWidgets uses to decide
whether to enable EGL support); if EGL isn't available at compile time,
both GLEW and wxWidgets will fall back on GLX
Note that you probably will have to blow away your CMakeCache for this to
work correctly -- otherwise, you may end up with the system GLEW, if you
have one installed (which is probably not what you want -- on Ubuntu, the
system GLEW is GLX, not EGL).
2023-01-11 09:09:57 +00:00
|
|
|
target_compile_definitions(GLEW PUBLIC GLEW_STATIC)
|
2022-07-15 15:37:19 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
${PROJECT_SOURCE_DIR}/include/GL/glew.h
|
|
|
|
${PROJECT_SOURCE_DIR}/include/GL/wglew.h
|
|
|
|
${PROJECT_SOURCE_DIR}/include/GL/glxew.h
|
Linux: update GLEW to 2.2.0, and enable EGL support in GLEW to match wxWidgets
On Linux, wxGTK by default attempts to use EGL if it is available on the
system, rather than GLX. Unfortunately, the ancient version of GLEW that we
packaged in did not support EGL, and even if it did, the configuration was
not set up to enable EGL. To solve this, we:
* upgrade GLEW to version 2.2.0, from upstream GitHub
* modify the Bambu build process to enforce that we use GLEW from the
built dependency
* remove the "extra" even older GLEW that was packaged
* modify GLEW's CMake configuration to enable EGL support when it is
available on the system (using the same test as wxWidgets uses to decide
whether to enable EGL support); if EGL isn't available at compile time,
both GLEW and wxWidgets will fall back on GLX
Note that you probably will have to blow away your CMakeCache for this to
work correctly -- otherwise, you may end up with the system GLEW, if you
have one installed (which is probably not what you want -- on Ubuntu, the
system GLEW is GLX, not EGL).
2023-01-11 09:09:57 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/include/GL/eglew.h
|
2022-07-15 15:37:19 +00:00
|
|
|
DESTINATION
|
|
|
|
${CMAKE_INSTALL_INCLUDEDIR}/GL
|
|
|
|
)
|
|
|
|
|
Linux: update GLEW to 2.2.0, and enable EGL support in GLEW to match wxWidgets
On Linux, wxGTK by default attempts to use EGL if it is available on the
system, rather than GLX. Unfortunately, the ancient version of GLEW that we
packaged in did not support EGL, and even if it did, the configuration was
not set up to enable EGL. To solve this, we:
* upgrade GLEW to version 2.2.0, from upstream GitHub
* modify the Bambu build process to enforce that we use GLEW from the
built dependency
* remove the "extra" even older GLEW that was packaged
* modify GLEW's CMake configuration to enable EGL support when it is
available on the system (using the same test as wxWidgets uses to decide
whether to enable EGL support); if EGL isn't available at compile time,
both GLEW and wxWidgets will fall back on GLX
Note that you probably will have to blow away your CMakeCache for this to
work correctly -- otherwise, you may end up with the system GLEW, if you
have one installed (which is probably not what you want -- on Ubuntu, the
system GLEW is GLX, not EGL).
2023-01-11 09:09:57 +00:00
|
|
|
install(TARGETS GLEW GLEW
|
2022-07-15 15:37:19 +00:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
|
|
)
|