Changeset 290138 in webkit
- Timestamp:
- Feb 18, 2022, 10:12:06 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r290002 r290138 1 2022-02-18 Adrian Perez de Castro <aperez@igalia.com> 2 3 [CMake] Cannot find OpenGL when system provides opengl.pc instead of gl.pc 4 https://bugs.webkit.org/show_bug.cgi?id=236592 5 6 Reviewed by Michael Catanzaro. 7 8 * Source/cmake/FindOpenGL.cmake: Rewrite to use imported targets, try the "opengl" and "glx" 9 pkg-config modules first, otherwise keep the existing logic that tried the "gl" pkg-config 10 module with fallbacks to find_path/find_library. 11 * Source/cmake/OptionsGTK.cmake: Check for the presence of the OpenGL::GLX target instead of 12 te GLX_FOUND variable. 13 1 14 2022-02-17 Commit Queue <commit-queue@webkit.org> 2 15 -
trunk/Source/ThirdParty/ANGLE/ChangeLog
r290118 r290138 1 2022-02-18 Adrian Perez de Castro <aperez@igalia.com> 2 3 [CMake] Cannot find OpenGL when system provides opengl.pc instead of gl.pc 4 https://bugs.webkit.org/show_bug.cgi?id=236592 5 6 Reviewed by Michael Catanzaro. 7 8 * PlatformGTK.cmake: Use the OpenGL::OpenGL imported target instead of the 9 OPENGL_LIBRARIES variable. 10 * PlatformWPE.cmake: Remove linking againt OpenGL libraries; the WPE port is not 11 supposed to link to any of them directly. 12 1 13 2022-02-18 Zan Dobersek <zdobersek@igalia.com> 2 14 -
trunk/Source/ThirdParty/ANGLE/PlatformGTK.cmake
r290118 r290138 34 34 35 35 if (USE_OPENGL) 36 list(APPEND ANGLEGLESv2_LIBRARIES ${OPENGL_LIBRARIES})36 list(APPEND ANGLEGLESv2_LIBRARIES OpenGL::OpenGL) 37 37 else () 38 38 list(APPEND ANGLEGLESv2_LIBRARIES OpenGL::GLES) -
trunk/Source/ThirdParty/ANGLE/PlatformWPE.cmake
r290118 r290138 33 33 Threads::Threads 34 34 ) 35 36 if (USE_OPENGL)37 list(APPEND ANGLEGLESv2_LIBRARIES ${OPENGL_LIBRARIES})38 else ()39 list(APPEND ANGLEGLESv2_LIBRARIES ${OPENGLES_LIBRARIES})40 endif ()41 35 endif () -
trunk/Source/WebCore/CMakeLists.txt
r290129 r290138 1705 1705 else () 1706 1706 if (USE_OPENGL) 1707 list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES 1708 ${OPENGL_INCLUDE_DIRS} 1709 ) 1710 list(APPEND WebCore_LIBRARIES 1711 ${OPENGL_LIBRARIES} 1712 ) 1713 add_definitions(${OPENGL_DEFINITIONS}) 1707 list(APPEND WebCore_LIBRARIES OpenGL::OpenGL) 1708 if (TARGET OpenGL::GLX) 1709 list(APPEND WebCore_LIBRARIES OpenGL::GLX) 1710 endif () 1714 1711 elseif (USE_OPENGL_ES) 1715 1712 list(APPEND WebCore_LIBRARIES OpenGL::GLES) -
trunk/Source/WebCore/ChangeLog
r290133 r290138 1 2022-02-18 Adrian Perez de Castro <aperez@igalia.com> 2 3 [CMake] Cannot find OpenGL when system provides opengl.pc instead of gl.pc 4 https://bugs.webkit.org/show_bug.cgi?id=236592 5 6 Reviewed by Michael Catanzaro. 7 8 * CMakeLists.txt: Use the OpenGL::OpenGL and OpenGL::GLX imported targets instead of variables. 9 * platform/graphics/GLContext.cpp: Move here includes for the GL headers. 10 * platform/graphics/GLContext.h: Remove includes for the GL headers, none of their 11 declarations are used here; instead include only the needed EGL headers to get the 12 definition of EGLNativeWindowType. 13 1 14 2022-02-18 Peng Liu <peng.liu6@apple.com> 2 15 -
trunk/Source/WebCore/platform/graphics/GLContext.cpp
r290002 r290138 26 26 #include <wtf/text/StringToIntegerConversion.h> 27 27 28 #if USE(LIBEPOXY) 29 #include <epoxy/gl.h> 30 #elif USE(OPENGL_ES) 31 #include <GLES2/gl2.h> 32 #else 33 #include "OpenGLShims.h" 34 #endif 35 28 36 #if USE(EGL) 29 37 #include "GLContextEGL.h" -
trunk/Source/WebCore/platform/graphics/GLContext.h
r290002 r290138 25 25 #include <wtf/Noncopyable.h> 26 26 27 #if USE(EGL) && !PLATFORM(GTK) 28 // FIXME: For now default to the GBM EGL platform, but this should really be 29 // somehow deducible from the build configuration. This is needed with libepoxy 30 // as it could have been configured with X11 support enabled, resulting in 31 // transitive inclusions of headers with definitions that clash with WebCore. 32 #define __GBM__ 1 27 33 #if USE(LIBEPOXY) 28 #include <epoxy/gl.h> 29 #elif USE(OPENGL_ES) 30 #include <GLES2/gl2.h> 31 #else 32 #include "OpenGLShims.h" 33 #endif 34 35 #if USE(EGL) && !PLATFORM(GTK) 36 #if PLATFORM(WPE) 37 // FIXME: For now default to the GBM EGL platform, but this should really be 38 // somehow deducible from the build configuration. 39 #define __GBM__ 1 40 #endif // PLATFORM(WPE) 34 #include <epoxy/egl.h> 35 #else // !USE(LIBEPOXY) 41 36 #include <EGL/eglplatform.h> 37 #endif // USE(LIBEPOXY) 42 38 typedef EGLNativeWindowType GLNativeWindowType; 43 39 #else // !USE(EGL) || PLATFORM(GTK) 44 40 typedef uint64_t GLNativeWindowType; 45 #endif 41 #endif // USE(EGL) && !PLATFORM(GTK) 46 42 47 43 #if USE(CAIRO) -
trunk/Source/WebKit/CMakeLists.txt
r290002 r290138 374 374 ) 375 375 else () 376 if (USE_OPENGL)377 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES378 ${OPENGL_INCLUDE_DIRS}379 )380 list(APPEND WebKit_PRIVATE_LIBRARIES381 ${OPENGL_LIBRARIES}382 )383 add_definitions(${OPENGL_DEFINITIONS})384 elseif (USE_OPENGL_ES)385 list(APPEND WebKit_PRIVATE_LIBRARIES OpenGL::GLES)386 endif ()387 388 376 if (USE_EGL) 389 377 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES -
trunk/Source/WebKit/ChangeLog
r290128 r290138 1 2022-02-18 Adrian Perez de Castro <aperez@igalia.com> 2 3 [CMake] Cannot find OpenGL when system provides opengl.pc instead of gl.pc 4 https://bugs.webkit.org/show_bug.cgi?id=236592 5 6 Reviewed by Michael Catanzaro. 7 8 * CMakeLists.txt: Remove usage of the OPENGL_ variables for the WebKit target, which is 9 uneeded because it links to WebCore, which transitively pulls the needed libraries now 10 that imported targets are being used. 11 1 12 2022-02-18 Tyler Wilcock <tyler_w@apple.com> 2 13 -
trunk/Source/cmake/FindOpenGL.cmake
r290002 r290138 1 # - Try to Find OpenGL 2 # Once done, this will define 3 # 4 # OPENGL_FOUND - system has OpenGL installed. 5 # OPENGL_INCLUDE_DIRS - directories which contain the OpenGL headers. 6 # OPENGL_LIBRARIES - libraries required to link against OpenGL. 7 # OPENGL_DEFINITIONS - Compiler switches required for using OpenGL. 8 # 9 # Copyright (C) 2015 Igalia S.L. 1 # Copyright (C) 2015, 2022 Igalia S.L. 10 2 # 11 3 # Redistribution and use in source and binary forms, with or without … … 29 21 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 30 22 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 # 24 #[=======================================================================[.rst: 25 FindOpenGL 26 ---------- 27 28 Find OpenGL headers and libraries. 29 30 Imported Targets 31 ^^^^^^^^^^^^^^^^ 32 33 ``OpenGL::OpenGL`` 34 The main OpenGL library, if found. It must *not* be assumed that this 35 library provides symbols other than the base OpenGL set. 36 ``OpenGL::GLX`` 37 The library containing the GL extension for the X11 windowing system, 38 if found. 39 40 Result Variables 41 ^^^^^^^^^^^^^^^^ 42 43 This will define the following variables in your project: 44 45 ``OpenGL_FOUND`` 46 True if the OpenGL library is available. 47 ``OpenGL_VERSION`` 48 The version of the found OpenGL library, if possible to determine it at 49 build configuration time. The variable may be undefined. 50 51 #]=======================================================================] 52 53 # TODO: 54 # - Make GLX an optional component of the find-module. 55 # - Make EGL an optional component here, remove FindEGL.cmake. 56 # - Consider whether FindGLES2.cmake could be moved here as well. 31 57 32 58 find_package(PkgConfig QUIET) 59 pkg_check_modules(PC_OPENGL IMPORTED_TARGET opengl) 33 60 34 pkg_check_modules(PC_OPENGL gl) 61 if (PC_OPENGL_FOUND AND TARGET PkgConfig::PC_OPENGL) 62 # 63 # If the "opengl" module exists, it should be preferred; and the library 64 # name will typically be libOpenGL.so; in this case if GLX support is 65 # available a "glx" module will *also* be available. This is a modern 66 # Unix-ish convention and expected to be always provided by pkg-config 67 # modules, so there is no need to fall-back to manually using find_path() 68 # and find_library(). 69 # 70 if (NOT TARGET OpenGL::OpenGL) 71 add_library(OpenGL::OpenGL INTERFACE IMPORTED GLOBAL) 72 set_property(TARGET OpenGL::OpenGL PROPERTY 73 INTERFACE_LINK_LIBRARIES PkgConfig::PC_OPENGL 74 ) 75 endif () 35 76 36 if (PC_OPENGL_FOUND) 37 set(OPENGL_DEFINITIONS ${PC_OPENGL_CFLAGS_OTHER}) 77 get_target_property(OpenGL_LIBRARY PkgConfig::PC_OPENGL INTERFACE_LINK_LIBRARIES) 78 79 pkg_check_modules(PC_GLX IMPORTED_TARGET glx) 80 if (TARGET PkgConfig::PC_GLX AND NOT TARGET OpenGL::GLX) 81 add_library(OpenGL::GLX INTERFACE IMPORTED GLOBAL) 82 set_property(TARGET OpenGL::GLX PROPERTY 83 INTERFACE_LINK_LIBRARIES PkgConfig::PC_GLX 84 ) 85 endif () 86 else () 87 # Otherwise, if an "opengl" pkg-config module does not exist, check for 88 # the "gl" one, which may or may not be present. 89 # 90 pkg_check_modules(PC_OPENGL gl) 91 find_path(OpenGL_INCLUDE_DIR 92 NAMES GL/gl.h 93 HINTS ${PC_OPENGL_INCLUDEDIR} ${PC_OPENGL_INCLUDE_DIRS} 94 ) 95 96 find_library(OpenGL_LIBRARY 97 NAMES ${OpenGL_NAMES} gl GL 98 HINTS ${PC_OPENGL_LIBDIR} ${PC_OPENGL_LIBRARY_DIRS} 99 ) 100 101 if (OpenGL_LIBRARY AND NOT TARGET OpenGL::OpenGL) 102 add_library(OpenGL::OpenGL UNKNOWN IMPORTED GLOBAL) 103 set_target_properties(OpenGL::OpenGL PROPERTIES 104 IMPORTED_LOCATION "${OpenGL_LIBRARY}" 105 INTERFACE_COMPILE_OPTIONS "${PC_OPENGL_CFLAGS_OTHER}" 106 INTERFACE_INCLUDE_DIRECTORIES "${OpenGL_INCLUDE_DIR}" 107 ) 108 endif () 109 110 if (TARGET OpenGL::OpenGL) 111 # We don't use find_package for GLX because it is part of -lGL, unlike EGL. We need to 112 # have OPENGL_INCLUDE_DIRS as part of the directories check_include_files() looks for in 113 # case OpenGL is installed into a non-standard location. 114 include(CMakePushCheckState) 115 CMAKE_PUSH_CHECK_STATE() 116 set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OpenGL_INCLUDE_DIR}) 117 include(CheckIncludeFiles) 118 check_include_files("GL/glx.h" OpenGL_GLX_FOUND) 119 CMAKE_POP_CHECK_STATE() 120 121 if (OpenGL_GLX_FOUND) 122 # XXX: Should this actually check that the OpenGL library contains the GLX symbols? 123 add_library(OpenGL::GLX INTERFACE IMPORTED GLOBAL) 124 set_property(TARGET OpenGL::GLX PROPERTY 125 INTERFACE_LINK_LIBRARIES OpenGL::OpenGL 126 ) 127 endif () 128 endif () 38 129 endif () 39 130 40 find_path(OPENGL_INCLUDE_DIRS NAMES GL/gl.h 41 HINTS ${PC_OPENGL_INCLUDEDIR} ${PC_OPENGL_INCLUDE_DIRS} 131 set(OpenGL_VERSION "${PC_OPENGL_VERSION}") 132 133 include(FindPackageHandleStandardArgs) 134 find_package_handle_standard_args(OpenGL 135 REQUIRED_VARS OpenGL_LIBRARY 136 FOUND_VAR OpenGL_FOUND 42 137 ) 43 138 44 set(OPENGL_NAMES ${OPENGL_NAMES} gl GL) 45 find_library(OPENGL_LIBRARIES NAMES ${OPENGL_NAMES} 46 HINTS ${PC_OPENGL_LIBDIR} ${PC_OPENGL_LIBRARY_DIRS} 47 ) 139 mark_as_advanced(OpenGL_INCLUDE_DIR OpenGL_LIBRARY) 48 140 49 include(FindPackageHandleStandardArgs) 50 find_package_handle_standard_args(OpenGL REQUIRED_VARS OPENGL_INCLUDE_DIRS OPENGL_LIBRARIES 51 FOUND_VAR OPENGL_FOUND) 52 53 mark_as_advanced(OPENGL_INCLUDE_DIRS OPENGL_LIBRARIES) 54 55 if (OPENGL_FOUND) 56 # We don't use find_package for GLX because it is part of -lGL, unlike EGL. We need to 57 # have OPENGL_INCLUDE_DIRS as part of the directories check_include_files() looks for in 58 # case OpenGL is installed into a non-standard location. 59 include(CMakePushCheckState) 60 CMAKE_PUSH_CHECK_STATE() 61 set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENGL_INCLUDE_DIRS}) 62 include(CheckIncludeFiles) 63 check_include_files("GL/glx.h" GLX_FOUND) 64 CMAKE_POP_CHECK_STATE() 141 if (OpenGL_FOUND) 142 set(OpenGL_LIBRARIES ${OpenGL_LIBRARY}) 143 set(OpenGL_INCLUDE_DIRS ${OpenGL_INCLUDE_DIR}) 65 144 endif () -
trunk/Source/cmake/OptionsGTK.cmake
r290002 r290138 366 366 endif () 367 367 368 if (NOT EGL_FOUND AND (NOT ENABLE_X11_TARGET OR NOT GLX_FOUND))368 if (NOT EGL_FOUND AND (NOT ENABLE_X11_TARGET OR NOT TARGET OpenGL::GLX)) 369 369 message(FATAL_ERROR "Either GLX or EGL is needed.") 370 370 endif () … … 374 374 SET_AND_EXPOSE_TO_BUILD(USE_EGL ${EGL_FOUND}) 375 375 376 if (ENABLE_X11_TARGET AND GLX_FOUND AND USE_OPENGL)376 if (ENABLE_X11_TARGET AND USE_OPENGL AND TARGET OpenGL::GLX) 377 377 SET_AND_EXPOSE_TO_BUILD(USE_GLX TRUE) 378 378 endif ()
Note:
See TracChangeset
for help on using the changeset viewer.