diff options
author | Christian Rauch <Rauch.Christian@gmx.de> | 2022-08-15 15:58:04 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-08-15 17:10:29 +0300 |
commit | a296b8f694d1a93d40da78312758580f69b43be7 (patch) | |
tree | fd5791d3227411c905c7c728f2d97fe19e28156f /build_files/cmake | |
parent | 90be364ca9b86f6dac78925166ba3ea567fc950d (diff) |
GPU: replace GLEW with libepoxy
With libepoxy we can choose between EGL and GLX at runtime, as well as
dynamically open EGL and GLX libraries without linking to them.
This will make it possible to build with Wayland, EGL, GLVND support while
still running on systems that only have X11, GLX and libGL. It also paves
the way for headless rendering through EGL.
libepoxy is a new library dependency, and is included in the precompiled
libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed.
Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton
and Sergey Sharybin.
Ref T76428
Differential Revision: https://developer.blender.org/D15291
Diffstat (limited to 'build_files/cmake')
-rw-r--r-- | build_files/cmake/Modules/FindEpoxy.cmake | 47 | ||||
-rw-r--r-- | build_files/cmake/Modules/FindGLEW.cmake | 58 | ||||
-rw-r--r-- | build_files/cmake/Modules/FindLibEpoxy.cmake | 47 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_apple.cmake | 3 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 1 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_win32.cmake | 7 |
6 files changed, 105 insertions, 58 deletions
diff --git a/build_files/cmake/Modules/FindEpoxy.cmake b/build_files/cmake/Modules/FindEpoxy.cmake new file mode 100644 index 00000000000..7cd26e45398 --- /dev/null +++ b/build_files/cmake/Modules/FindEpoxy.cmake @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2022 Blender Foundation. + +# This module defines +# Epoxy_INCLUDE_DIRS, where to find epoxy/gl.h +# Epoxy_LIBRARY, where to find the epoxy library. +# Epoxy_ROOT_DIR, The base directory to search for epoxy. +# This can also be an environment variable. +# Epoxy_FOUND, If false, do not try to use epoxy. + +IF(NOT EPOXY_ROOT_DIR AND NOT $ENV{EPOXY_ROOT_DIR} STREQUAL "") + SET(EPOXY_ROOT_DIR $ENV{EPOXY_ROOT_DIR}) +ENDIF() + +FIND_PATH(Epoxy_INCLUDE_DIR + NAMES + epoxy/gl.h + HINTS + ${EPOXY_ROOT_DIR} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(Epoxy_LIBRARY + NAMES + epoxy + HINTS + ${EPOXY_ROOT_DIR} + PATH_SUFFIXES + lib64 lib +) + +# handle the QUIETLY and REQUIRED arguments and set Epoxy_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Epoxy DEFAULT_MSG + Epoxy_LIBRARY Epoxy_INCLUDE_DIR) + +IF(Epoxy_FOUND) + SET(Epoxy_INCLUDE_DIRS ${Epoxy_INCLUDE_DIR}) + SET(Epoxy_LIBRARIES ${Epoxy_LIBRARY}) +ENDIF() + +MARK_AS_ADVANCED( + Epoxy_INCLUDE_DIR + Epoxy_LIBRARY +) diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake deleted file mode 100644 index 33b989ec49e..00000000000 --- a/build_files/cmake/Modules/FindGLEW.cmake +++ /dev/null @@ -1,58 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2014 Blender Foundation. - -# - Find GLEW library -# Find the native Glew includes and library -# This module defines -# GLEW_INCLUDE_DIRS, where to find glew.h, Set when -# GLEW_INCLUDE_DIR is found. -# GLEW_ROOT_DIR, The base directory to search for Glew. -# This can also be an environment variable. -# GLEW_FOUND, If false, do not try to use Glew. -# -# also defined, -# GLEW_LIBRARY, where to find the Glew library. - -# If GLEW_ROOT_DIR was defined in the environment, use it. -IF(NOT GLEW_ROOT_DIR AND NOT $ENV{GLEW_ROOT_DIR} STREQUAL "") - SET(GLEW_ROOT_DIR $ENV{GLEW_ROOT_DIR}) -ENDIF() - -SET(_glew_SEARCH_DIRS - ${GLEW_ROOT_DIR} -) - -FIND_PATH(GLEW_INCLUDE_DIR - NAMES - GL/glew.h - HINTS - ${_glew_SEARCH_DIRS} - PATH_SUFFIXES - include -) - -FIND_LIBRARY(GLEW_LIBRARY - NAMES - GLEW - HINTS - ${_glew_SEARCH_DIRS} - PATH_SUFFIXES - lib64 lib - ) - -# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG - GLEW_LIBRARY GLEW_INCLUDE_DIR) - -IF(GLEW_FOUND) - SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) -ENDIF() - -MARK_AS_ADVANCED( - GLEW_INCLUDE_DIR - GLEW_LIBRARY -) - -UNSET(_glew_SEARCH_DIRS) diff --git a/build_files/cmake/Modules/FindLibEpoxy.cmake b/build_files/cmake/Modules/FindLibEpoxy.cmake new file mode 100644 index 00000000000..1da52f95f68 --- /dev/null +++ b/build_files/cmake/Modules/FindLibEpoxy.cmake @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2022 Blender Foundation. + +# This module defines +# LibEpoxy_INCLUDE_DIRS, where to find epoxy/gl.h +# LibEpoxy_LIBRARY, where to find the epoxy library. +# LibEpoxy_ROOT_DIR, The base directory to search for libepoxy. +# This can also be an environment variable. +# LibEpoxy_FOUND, If false, do not try to use libepoxy. + +IF(NOT EPOXY_ROOT_DIR AND NOT $ENV{EPOXY_ROOT_DIR} STREQUAL "") + SET(EPOXY_ROOT_DIR $ENV{EPOXY_ROOT_DIR}) +ENDIF() + +FIND_PATH(LibEpoxy_INCLUDE_DIR + NAMES + epoxy/gl.h + HINTS + ${EPOXY_ROOT_DIR} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(LibEpoxy_LIBRARY + NAMES + epoxy + HINTS + ${EPOXY_ROOT_DIR} + PATH_SUFFIXES + lib64 lib +) + +# handle the QUIETLY and REQUIRED arguments and set LibEpoxy_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibEpoxy DEFAULT_MSG + LibEpoxy_LIBRARY LibEpoxy_INCLUDE_DIR) + +IF(LibEpoxy_FOUND) + SET(LibEpoxy_INCLUDE_DIRS ${LibEpoxy_INCLUDE_DIR}) + SET(LibEpoxy_LIBRARIES ${LibEpoxy_LIBRARY}) +ENDIF() + +MARK_AS_ADVANCED( + LibEpoxy_INCLUDE_DIR + LibEpoxy_LIBRARY +) diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index f84be3c5238..f39cb7a4951 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -226,6 +226,9 @@ if(WITH_SDL) endif() endif() +set(EPOXY_ROOT_DIR ${LIBDIR}/epoxy) +find_package(Epoxy REQUIRED) + set(PNG_ROOT ${LIBDIR}/png) find_package(PNG REQUIRED) diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 0d7ed9d618c..bfba89d3a13 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -95,6 +95,7 @@ find_package_wrapper(JPEG REQUIRED) find_package_wrapper(PNG REQUIRED) find_package_wrapper(ZLIB REQUIRED) find_package_wrapper(Zstd REQUIRED) +find_package_wrapper(Epoxy REQUIRED) function(check_freetype_for_brotli) include(CheckSymbolExists) diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index e81582f0460..66ab0d4169a 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -323,6 +323,13 @@ if(NOT JPEG_FOUND) set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib) endif() +set(EPOXY_ROOT_DIR ${LIBDIR}/epoxy) +windows_find_package(Epoxy REQUIRED) +if(NOT EPOXY_FOUND) + set(Epoxy_INCLUDE_DIRS ${LIBDIR}/epoxy/include) + set(Epoxy_LIBRARIES ${LIBDIR}/epoxy/lib/epoxy.lib) +endif() + set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include) set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC3.lib) |