Skip to content

Commit

Permalink
Add support for building WebView with libwebkit2gtk-4.1
Browse files Browse the repository at this point in the history
libwebkit2gtk-4.1 has the same API as libwebkit2gtk-4.0, except that the
former links with libsoup-3.0 and the latter links with libsoup-2.4.

Fixes #23630.
  • Loading branch information
swt2c authored and MackBambu committed Jun 7, 2024
1 parent a8e20d0 commit 63af1d6
Show file tree
Hide file tree
Showing 6 changed files with 8,352 additions and 6,809 deletions.
10 changes: 8 additions & 2 deletions build/cmake/init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -436,15 +436,21 @@ if(wxUSE_GUI)
if(wxUSE_WEBVIEW)
if(WXGTK)
if(wxUSE_WEBVIEW_WEBKIT)
find_package(LIBSOUP)
set(WEBKIT_LIBSOUP_VERSION 2.4)
if(WXGTK2)
find_package(WEBKIT 1.0)
elseif(WXGTK3)
find_package(WEBKIT2)
find_package(WEBKIT2 4.1)
if(WEBKIT2_FOUND)
set(WEBKIT_LIBSOUP_VERSION 3.0)
else()
find_package(WEBKIT2 4.0)
endif()
if(NOT WEBKIT2_FOUND)
find_package(WEBKIT 3.0)
endif()
endif()
find_package(LIBSOUP ${WEBKIT_LIBSOUP_VERSION})
endif()
set(wxUSE_WEBVIEW_WEBKIT OFF)
set(wxUSE_WEBVIEW_WEBKIT2 OFF)
Expand Down
14 changes: 11 additions & 3 deletions build/cmake/modules/FindLIBSOUP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,27 @@
# LibSoup does not provide an easy way to retrieve its version other than its
# .pc file, so we need to rely on PC_LIBSOUP_VERSION and REQUIRE the .pc file
# to be found.
SET(LIBSOUP_VERSION 2.4)
if(DEFINED LIBSOUP_FIND_VERSION)
SET(LIBSOUP_VERSION ${LIBSOUP_FIND_VERSION})
endif()

set(LIBSOUP_INCLUDE_DIRS LIBSOUP_INCLUDE_DIRS-NOTFOUND)
set(LIBSOUP_LIBRARIES LIBSOUP_LIBRARIES-NOTFOUND)

FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_LIBSOUP QUIET libsoup-2.4)
PKG_CHECK_MODULES(PC_LIBSOUP QUIET libsoup-${LIBSOUP_VERSION})

if(PC_LIBSOUP_FOUND)
FIND_PATH(LIBSOUP_INCLUDE_DIRS
NAMES libsoup/soup.h
HINTS ${PC_LIBSOUP_INCLUDEDIR}
${PC_LIBSOUP_INCLUDE_DIRS}
PATH_SUFFIXES libsoup-2.4
PATH_SUFFIXES libsoup-${LIBSOUP_VERSION}
)

FIND_LIBRARY(LIBSOUP_LIBRARIES
NAMES soup-2.4
NAMES soup-${LIBSOUP_VERSION}
HINTS ${PC_LIBSOUP_LIBDIR}
${PC_LIBSOUP_LIBRARY_DIRS}
)
Expand Down
5 changes: 4 additions & 1 deletion build/cmake/modules/FindWEBKIT2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
# WEBKIT2_LIBRARIES - List of libraries when using Webkit2.
# WEBKIT2_FOUND - True if Webkit2 found.

SET( WEBKIT2_VERSION 4.0)
SET(WEBKIT2_VERSION 4.0)
if(DEFINED WEBKIT2_FIND_VERSION)
SET(WEBKIT2_VERSION ${WEBKIT2_FIND_VERSION})
endif()

set(WEBKIT2_INCLUDE_DIR WEBKIT2_INCLUDE_DIR-NOTFOUND)
set(WEBKIT2_LIBRARY WEBKIT2_LIBRARY-NOTFOUND)
Expand Down
Loading

0 comments on commit 63af1d6

Please sign in to comment.