mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
CMake: Add GTK4 as a GUI framework option
Add GTK as a possible GUI framework alongside Qt on Linux. When the gtk or qt vcpkg manifest feature is selected, the corresponding framework dependencies are pulled in automatically.
This commit is contained in:
Notes:
github-actions[bot]
2026-04-17 15:19:30 +00:00
Author: https://github.com/jdahlin Commit: https://github.com/LadybirdBrowser/ladybird/commit/1bf03c21d1d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8691 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/christianfrey Reviewed-by: https://github.com/cqundefine Reviewed-by: https://github.com/trflynn89 ✅
@@ -14,9 +14,15 @@ if (APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 14.0)
|
||||
endif()
|
||||
|
||||
# Pass additional information to vcpkg toolchain files if we are using vcpkg.
|
||||
include("Meta/CMake/gui_framework.cmake")
|
||||
|
||||
# Pass additional information to vcpkg if we are using it.
|
||||
if (CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg.cmake$")
|
||||
set(CMAKE_PROJECT_ladybird_INCLUDE_BEFORE "Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake")
|
||||
if (LADYBIRD_GUI_FRAMEWORK STREQUAL "Qt" OR LADYBIRD_GUI_FRAMEWORK STREQUAL "Gtk")
|
||||
string(TOLOWER "${LADYBIRD_GUI_FRAMEWORK}" framework_feature)
|
||||
set(VCPKG_MANIFEST_FEATURES "${framework_feature}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (APPLE AND NOT CMAKE_OSX_SYSROOT)
|
||||
|
||||
@@ -5,7 +5,7 @@ elseif (APPLE)
|
||||
set(_possible_guis "AppKit" "Qt")
|
||||
set(_default_gui "AppKit")
|
||||
else()
|
||||
set(_possible_guis "Qt")
|
||||
set(_possible_guis "Qt" "Gtk")
|
||||
set(_default_gui "Qt")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@ if (CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
string(APPEND EXTRA_VCPKG_VARIABLES "set(VCPKG_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET})\n")
|
||||
endif()
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/build-vcpkg-variables.cmake" "${EXTRA_VCPKG_VARIABLES}")
|
||||
|
||||
# Munge the VCPKG_TRIPLET to correspond to the right one for our presets
|
||||
# Just make sure not to override if the developer is trying to cross-compile
|
||||
# or the developer set it manually, or if this is not the first run of CMake
|
||||
@@ -88,3 +86,9 @@ if (NOT DEFINED CACHE{VCPKG_TARGET_TRIPLET} AND NOT DEFINED CACHE{VCPKG_HOST_TRI
|
||||
set(VCPKG_TARGET_TRIPLET ${full_triplet} CACHE STRING "")
|
||||
set(VCPKG_HOST_TRIPLET ${full_triplet} CACHE STRING "")
|
||||
endif()
|
||||
|
||||
if (VCPKG_TARGET_TRIPLET MATCHES ".*linux.*" AND "gtk" IN_LIST VCPKG_MANIFEST_FEATURES)
|
||||
string(APPEND EXTRA_VCPKG_VARIABLES "set(X_VCPKG_FORCE_VCPKG_WAYLAND_LIBRARIES ON)\n")
|
||||
endif()
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/build-vcpkg-variables.cmake" "${EXTRA_VCPKG_VARIABLES}")
|
||||
|
||||
132
vcpkg.json
132
vcpkg.json
@@ -119,52 +119,6 @@
|
||||
"name": "pthread",
|
||||
"platform": "windows"
|
||||
},
|
||||
{
|
||||
"name": "qtbase",
|
||||
"platform": "freebsd",
|
||||
"default-features": false,
|
||||
"features": [
|
||||
"dbus",
|
||||
"doubleconversion",
|
||||
"fontconfig",
|
||||
"freetype",
|
||||
"gui",
|
||||
"icu",
|
||||
"jpeg",
|
||||
"network",
|
||||
"opengl",
|
||||
"pcre2",
|
||||
"png",
|
||||
"thread",
|
||||
"vulkan",
|
||||
"widgets",
|
||||
"xcb",
|
||||
"xcb-xlib",
|
||||
"xlib",
|
||||
"xrender",
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "qtbase",
|
||||
"platform": "windows",
|
||||
"default-features": false,
|
||||
"features": [
|
||||
"doubleconversion",
|
||||
"freetype",
|
||||
"gui",
|
||||
"icu",
|
||||
"jpeg",
|
||||
"network",
|
||||
"opengl",
|
||||
"pcre2",
|
||||
"png",
|
||||
"thread",
|
||||
"vulkan",
|
||||
"widgets",
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sdl3",
|
||||
"default-features": false
|
||||
@@ -225,6 +179,82 @@
|
||||
"woff2",
|
||||
"zlib"
|
||||
],
|
||||
"features": {
|
||||
"gtk": {
|
||||
"description": "Build with GTK 4 GUI framework",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "libadwaita",
|
||||
"platform": "linux"
|
||||
},
|
||||
{
|
||||
"name": "wayland",
|
||||
"platform": "linux",
|
||||
"features": [
|
||||
"force-build"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "wayland-protocols",
|
||||
"platform": "linux",
|
||||
"features": [
|
||||
"force-build"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"qt": {
|
||||
"description": "Build with Qt 6 GUI framework",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "qtbase",
|
||||
"platform": "freebsd",
|
||||
"default-features": false,
|
||||
"features": [
|
||||
"dbus",
|
||||
"doubleconversion",
|
||||
"fontconfig",
|
||||
"freetype",
|
||||
"gui",
|
||||
"icu",
|
||||
"jpeg",
|
||||
"network",
|
||||
"opengl",
|
||||
"pcre2",
|
||||
"png",
|
||||
"thread",
|
||||
"vulkan",
|
||||
"widgets",
|
||||
"xcb",
|
||||
"xcb-xlib",
|
||||
"xlib",
|
||||
"xrender",
|
||||
"zstd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "qtbase",
|
||||
"platform": "windows",
|
||||
"default-features": false,
|
||||
"features": [
|
||||
"doubleconversion",
|
||||
"freetype",
|
||||
"gui",
|
||||
"icu",
|
||||
"jpeg",
|
||||
"network",
|
||||
"opengl",
|
||||
"pcre2",
|
||||
"png",
|
||||
"thread",
|
||||
"vulkan",
|
||||
"widgets",
|
||||
"zstd"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"name": "angle",
|
||||
@@ -262,9 +292,13 @@
|
||||
"name": "fmt",
|
||||
"version": "12.1.0#0"
|
||||
},
|
||||
{
|
||||
"name": "gtk",
|
||||
"version": "4.22.0"
|
||||
},
|
||||
{
|
||||
"name": "fontconfig",
|
||||
"version": "2.15.0#4"
|
||||
"version": "2.17.1#1"
|
||||
},
|
||||
{
|
||||
"name": "harfbuzz",
|
||||
@@ -274,6 +308,10 @@
|
||||
"name": "icu",
|
||||
"version": "78.2#0"
|
||||
},
|
||||
{
|
||||
"name": "libadwaita",
|
||||
"version": "1.8.4"
|
||||
},
|
||||
{
|
||||
"name": "libavif",
|
||||
"version": "1.3.0#1"
|
||||
|
||||
Reference in New Issue
Block a user