Skip to content

Commit

Permalink
[WPE][CMake] Allow disabling the build of WTR without disabling the C…
Browse files Browse the repository at this point in the history
…og build and also control the platform plugins of Cog

https://bugs.webkit.org/show_bug.cgi?id=249036

Reviewed by Michael Catanzaro.

When building WPE for the rpi3 using the script build-webkit with a
yocto-based-cross-toolchain I found this issues:

 - for mesa-vc4 target: gtk4 is not available so the
   build fails when cog tries to enable the gtk4 plugin
 - for userland target: wpebackend-fdo is not available (only wpebackend-rdk)
   and wpebackend-fdo is needed to build WebKitTestRunner, the API tests runner
   and the MiniBrowser.

To fix this issues this patch allows to have more control over how Cog is built
and also to disable the build of WTR, MiniBrowser and APITestRunner meanwhile
keeping the build of Cog enabled.

After this patch this is how you would build for this targets:

rpi3-mesa-vc4:
  -DENABLE_COG=ON -DWPE_COG_PLATFORMS=drm,headless,wayland
  So gtk4 is disabled

rpi3-userland:
  -DENABLE_MINIBROWSER=OFF -DENABLE_API_TESTS=OFF -DENABLE_LAYOUT_TESTS=OFF -DENABLE_COG=ON -DWPE_COG_PLATFORMS=none
  So only Cog gets built and also it builds without platform plugins (which require wpebackend-fdo)
  The keyword 'none' is used as a special key in CMake to later pass to the Cog meson build
  the parameter "-Dplatforms=" which is needed to set the list of platforms to empty instead
  of using the default defined on Cog at meson_options.txt

This patch also fixes the build on a cross-build environment by passing the path
of the cross-toolchain pkg_config to the Cog build.

And finally it also changes the GTK port to start using also the new introduced
CMake option ENABLE_LAYOUT_TESTS for consistency.

* Source/cmake/OptionsGTK.cmake
* Source/cmake/OptionsWPE.cmake:
* Source/cmake/WebKitFeatures.cmake:
* Tools/PlatformGTK.cmake:
* Tools/PlatformWPE.cmake:

Canonical link: https://commits.webkit.org/257827@main
  • Loading branch information
clopez committed Dec 14, 2022
1 parent 5c92b69 commit 7aa121b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Source/cmake/OptionsGTK.cmake
Expand Up @@ -95,8 +95,10 @@ WEBKIT_OPTION_CONFLICT(USE_GTK4 USE_SOUP2)
SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
if (DEVELOPER_MODE)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYOUT_TESTS PRIVATE ON)
else ()
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYOUT_TESTS PRIVATE OFF)
endif ()

if (CMAKE_SYSTEM_NAME MATCHES "Linux")
Expand Down
1 change: 1 addition & 0 deletions Source/cmake/OptionsWPE.cmake
Expand Up @@ -121,6 +121,7 @@ endif ()

if (ENABLE_DEVELOPER_MODE)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYOUT_TESTS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_COG PRIVATE ON)
endif ()
Expand Down
1 change: 1 addition & 0 deletions Source/cmake/WebKitFeatures.cmake
Expand Up @@ -187,6 +187,7 @@ macro(WEBKIT_OPTION_BEGIN)
WEBKIT_OPTION_DEFINE(ENABLE_LLVM_PROFILE_GENERATION "Include LLVM's instrumentation to generate profiles for PGO" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER "Toggle legacy protocol manager support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_ENCRYPTED_MEDIA "Toggle Legacy EME V2 support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_LAYOUT_TESTS "Enable layout test support (WebkitTestRunner)" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_LETTERPRESS "Toggle letterpress support" PRIVATE OFF)
WEBKIT_OPTION_DEFINE(ENABLE_MATHML "Toggle MathML support" PRIVATE ON)
WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_CAPTURE "Toggle Media Capture support" PRIVATE OFF)
Expand Down
11 changes: 7 additions & 4 deletions Tools/PlatformGTK.cmake
@@ -1,12 +1,15 @@
if (DEVELOPER_MODE)
if (ENABLE_LAYOUT_TESTS)
add_subdirectory(TestRunnerShared)
add_subdirectory(WebKitTestRunner)
add_subdirectory(ImageDiff)
endif ()

if (DEVELOPER_MODE)
add_subdirectory(flatpak)
endif ()

if (ENABLE_API_TESTS)
add_subdirectory(TestWebKitAPI/glib)
endif ()
if (ENABLE_API_TESTS)
add_subdirectory(TestWebKitAPI/glib)
endif ()

if (ENABLE_MINIBROWSER)
Expand Down
29 changes: 21 additions & 8 deletions Tools/PlatformWPE.cmake
@@ -1,24 +1,37 @@
if (DEVELOPER_MODE OR ENABLE_MINIBROWSER)
if (ENABLE_API_TESTS OR ENABLE_LAYOUT_TESTS OR ENABLE_MINIBROWSER)
add_subdirectory(wpe/backends)
endif ()

if (DEVELOPER_MODE)
if (ENABLE_LAYOUT_TESTS)
add_subdirectory(ImageDiff)
add_subdirectory(TestRunnerShared)
add_subdirectory(WebKitTestRunner)
endif ()

if (DEVELOPER_MODE)
add_subdirectory(flatpak)
endif ()

if (ENABLE_API_TESTS)
add_subdirectory(TestWebKitAPI/glib)
endif ()
if (ENABLE_API_TESTS)
add_subdirectory(TestWebKitAPI/glib)
endif ()

if (ENABLE_MINIBROWSER)
add_subdirectory(MiniBrowser/wpe)
endif ()

if (DEVELOPER_MODE AND ENABLE_COG)
if (ENABLE_COG)
include(ExternalProject)
if ("${WPE_COG_PLATFORMS}" STREQUAL "")
set(WPE_COG_PLATFORMS "drm,headless,gtk4,x11,wayland")
elseif ("${WPE_COG_PLATFORMS}" STREQUAL "none")
set(WPE_COG_PLATFORMS "")
endif ()
if (DEFINED ENV{PKG_CONFIG_PATH})
set(WPE_COG_PKG_CONFIG_PATH ${CMAKE_BINARY_DIR}:$ENV{PKG_CONFIG_PATH})
else ()
set(WPE_COG_PKG_CONFIG_PATH ${CMAKE_BINARY_DIR})
endif ()
if ("${WPE_COG_REPO}" STREQUAL "")
set(WPE_COG_REPO "https://github.com/Igalia/cog.git")
endif ()
Expand Down Expand Up @@ -52,9 +65,9 @@ if (DEVELOPER_MODE AND ENABLE_COG)
CONFIGURE_COMMAND
meson setup <BINARY_DIR> <SOURCE_DIR>
--buildtype ${COG_MESON_BUILDTYPE}
--pkg-config-path ${CMAKE_BINARY_DIR}
--pkg-config-path ${WPE_COG_PKG_CONFIG_PATH}
-Dsoup2=${COG_MESON_SOUP2}
-Dplatforms=drm,headless,gtk4,x11,wayland
-Dplatforms=${WPE_COG_PLATFORMS}
BUILD_COMMAND
meson compile -C <BINARY_DIR>
INSTALL_COMMAND "")
Expand Down

0 comments on commit 7aa121b

Please sign in to comment.