Use vcpkg GTK3 with enabled wayland (#772)

This commit is contained in:
Exzap 2023-04-15 12:21:08 +02:00 committed by GitHub
parent ecb7b77326
commit a6e9481b64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 276 additions and 10 deletions

View File

@ -53,7 +53,7 @@ jobs:
- name: "Install system dependencies"
run: |
sudo apt update -qq
sudo apt install -y clang-12 cmake freeglut3-dev libgcrypt20-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev libudev-dev nasm ninja-build
sudo apt install -y clang-12 cmake freeglut3-dev libgcrypt20-dev libglm-dev libx11-dev libgles2-mesa-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev libudev-dev nasm ninja-build
- name: "Bootstrap vcpkg"
run: |
@ -107,10 +107,13 @@ jobs:
- name: "Install system dependencies"
run: |
sudo apt update -qq
sudo apt install -y clang-12 cmake freeglut3-dev libgcrypt20-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev nasm ninja-build appstream
sudo apt install -y clang-12 cmake freeglut3-dev libgcrypt20-dev libglm-dev libx11-dev libgles2-mesa-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev nasm ninja-build appstream
- name: "Build AppImage"
run: dist/linux/appimage.sh
run: |
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
export DEPLOY_GTK_VERSION=3
dist/linux/appimage.sh
- name: Upload artifact
uses: actions/upload-artifact@v3

View File

@ -25,7 +25,7 @@ To compile Cemu, a recent enough compiler and STL with C++20 support is required
### Installing dependencies
#### For Ubuntu and derivatives:
`sudo apt install -y cmake curl freeglut3-dev git libgcrypt20-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev nasm ninja-build`
`sudo apt install -y cmake curl freeglut3-dev git libgcrypt20-dev libglm-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev nasm ninja-build`
*Additionally, for Ubuntu 22.04 only:*
- `sudo apt install -y clang-12`
@ -33,10 +33,10 @@ To compile Cemu, a recent enough compiler and STL with C++20 support is required
`cmake -S . -B build -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-12 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja`
#### For Arch and derivatives:
`sudo pacman -S --needed base-devel clang cmake freeglut git gtk3 libgcrypt libpulse libsecret linux-headers llvm nasm ninja systemd unzip zip`
`sudo pacman -S --needed base-devel clang cmake freeglut git glm gtk3 libgcrypt libpulse libsecret linux-headers llvm nasm ninja systemd unzip zip`
#### For Fedora and derivatives:
`sudo dnf install clang cmake cubeb-devel freeglut-devel git gtk3-devel kernel-headers libgcrypt-devel libsecret-devel nasm ninja-build perl-core systemd-devel zlib-devel`
`sudo dnf install clang cmake cubeb-devel freeglut-devel git glm-devel gtk3-devel kernel-headers libgcrypt-devel libsecret-devel nasm ninja-build perl-core systemd-devel zlib-devel`
### Build Cemu using cmake and clang
1. `git clone --recursive https://github.com/cemu-project/Cemu`

View File

@ -0,0 +1,13 @@
diff --git a/meson.build b/meson.build
index c599843..0cafd79 100644
--- a/meson.build
+++ b/meson.build
@@ -1008,7 +1008,7 @@ subdir('docs/reference')
install_data('m4macros/gtk-3.0.m4', install_dir: join_paths(get_option('datadir'), 'aclocal'))
-if not meson.is_cross_build()
+if false
if meson.version().version_compare('>=0.57.0')
gnome.post_install(
glib_compile_schemas: true,

View File

@ -0,0 +1,62 @@
diff --git a/gtk/meson.build b/gtk/meson.build
index 79f4f0d..33a7723 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1074,6 +1074,7 @@ gtk_query_settings = executable(
'gtk-query-settings.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_query_settings
@@ -1083,6 +1084,7 @@ gtk_builder_tool = executable(
'gtk-builder-tool.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_builder_tool
@@ -1115,6 +1117,7 @@ gtk_update_icon_cache = executable(
extra_update_icon_cache_objs,
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_update_icon_cache
@@ -1125,6 +1128,7 @@ gtk_query_immodules = executable(
'gtkutils.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_query_immodules
@@ -1134,6 +1138,7 @@ gtk_encode_symbolic_svg = executable(
'encodesymbolic.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_encode_symbolic_svg
@@ -1143,6 +1148,7 @@ gtk_launch = executable(
'gtk-launch.c',
c_args: gtk_cargs,
dependencies: libgtk_dep,
+ link_language: 'cpp',
install: true
)
gtk_tools += gtk_launch
diff --git a/meson.build b/meson.build
index 287f0cb..d35106f 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('gtk+-3.0', 'c',
+project('gtk+-3.0', 'c', 'cpp',
version: '3.24.34',
default_options: [
'buildtype=debugoptimized',

View File

@ -1 +1,98 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
set(warning_length 24)
string(LENGTH "${CURRENT_BUILDTREES_DIR}" buildtrees_path_length)
if(buildtrees_path_length GREATER warning_length AND CMAKE_HOST_WIN32)
message(WARNING "${PORT}'s buildsystem uses very long paths and may fail on your system.\n"
"We recommend moving vcpkg to a short path such as 'C:\\vcpkg' or using the subst command."
)
endif()
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
vcpkg_from_gitlab(
OUT_SOURCE_PATH SOURCE_PATH
GITLAB_URL https://gitlab.gnome.org
REPO GNOME/gtk
REF "${VERSION}"
SHA512 20a91e30a89070461af06b33829bc723b348806b4a785d0743af8bd4789b55dade24686e08bf1b2f0335240463aacc040134babb0605b809186b15de9cf261e4
PATCHES
0001-build.patch
cairo-cpp-linkage.patch
)
vcpkg_find_acquire_program(PKGCONFIG)
get_filename_component(PKGCONFIG_DIR "${PKGCONFIG}" DIRECTORY )
vcpkg_add_to_path("${PKGCONFIG_DIR}") # Post install script runs pkg-config so it needs to be on PATH
vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/tools/glib/")
vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/tools/gdk-pixbuf")
vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/tools/gettext/bin")
if("introspection" IN_LIST FEATURES)
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
message(FATAL_ERROR "Feature introspection currently only supports dynamic build.")
endif()
list(APPEND OPTIONS_DEBUG -Dintrospection=false)
list(APPEND OPTIONS_RELEASE -Dintrospection=true)
else()
list(APPEND OPTIONS -Dintrospection=false)
endif()
if(CMAKE_HOST_WIN32 AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(GIR_TOOL_DIR ${CURRENT_INSTALLED_DIR})
else()
set(GIR_TOOL_DIR ${CURRENT_HOST_INSTALLED_DIR})
endif()
vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${OPTIONS}
-Dwayland_backend=true
-Ddemos=false
-Dexamples=false
-Dtests=false
-Dgtk_doc=false
-Dman=false
-Dxinerama=no # Enable support for the X11 Xinerama extension
-Dcloudproviders=false # Enable the cloudproviders support
-Dprofiler=false # include tracing support for sysprof
-Dtracker3=false # Enable Tracker3 filechooser search
-Dcolord=no # Build colord support for the CUPS printing backend
OPTIONS_DEBUG
${OPTIONS_DEBUG}
OPTIONS_RELEASE
${OPTIONS_RELEASE}
ADDITIONAL_BINARIES
"glib-genmarshal='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-genmarshal'"
"glib-mkenums='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-mkenums'"
"glib-compile-resources='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-resources${VCPKG_HOST_EXECUTABLE_SUFFIX}'"
"gdbus-codegen='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/gdbus-codegen'"
"glib-compile-schemas='${CURRENT_HOST_INSTALLED_DIR}/tools/glib/glib-compile-schemas${VCPKG_HOST_EXECUTABLE_SUFFIX}'"
"g-ir-compiler='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-compiler${VCPKG_HOST_EXECUTABLE_SUFFIX}'"
"g-ir-scanner='${GIR_TOOL_DIR}/tools/gobject-introspection/g-ir-scanner'"
)
# Reduce command line lengths, in particular for static windows builds.
foreach(dir IN ITEMS "${TARGET_TRIPLET}-dbg" "${TARGET_TRIPLET}-rel")
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${dir}/build.ninja")
vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${dir}/build.ninja" "/${dir}/../src/" "/src/")
endif()
endforeach()
vcpkg_install_meson(ADD_BIN_TO_PATH)
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
set(GTK_TOOLS
gtk-builder-tool
gtk-encode-symbolic-svg
gtk-launch
gtk-query-immodules-3.0
gtk-query-settings
gtk-update-icon-cache
)
vcpkg_copy_tools(TOOL_NAMES ${GTK_TOOLS} AUTO_CLEAN)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/etc")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,8 +1,99 @@
{
"name": "gtk3",
"version": "3.24.34",
"port-version": 3,
"port-version": 4,
"description": "Portable library for creating graphical user interfaces.",
"homepage": "https://www.gtk.org/",
"license": null
"license": null,
"dependencies": [
{
"name": "at-spi2-atk",
"platform": "linux"
},
"atk",
{
"name": "cairo",
"default-features": false,
"features": [
"gobject"
]
},
{
"name": "cairo",
"default-features": false,
"features": [
"x11"
],
"platform": "linux"
},
"gdk-pixbuf",
{
"name": "gdk-pixbuf",
"host": true
},
"gettext",
{
"name": "gettext",
"host": true,
"default-features": false,
"features": [
"tools"
]
},
"glib",
{
"name": "glib",
"host": true
},
"libepoxy",
"pango",
{
"name": "vcpkg-tool-meson",
"host": true
}
],
"features": {
"introspection": {
"description": "build with introspection",
"dependencies": [
{
"name": "atk",
"default-features": false,
"features": [
"introspection"
]
},
{
"name": "gdk-pixbuf",
"host": true,
"default-features": false,
"features": [
"introspection"
]
},
{
"name": "gdk-pixbuf",
"default-features": false,
"features": [
"introspection"
]
},
{
"name": "gobject-introspection",
"host": true
},
{
"name": "gobject-introspection",
"platform": "windows & x86"
},
{
"name": "pango",
"default-features": false,
"features": [
"introspection"
]
}
]
}
}
}

View File

@ -46,7 +46,7 @@ fi
echo "Cemu Version Cemu-${GITVERSION}"
rm AppDir/usr/lib/libwayland-client.so.0
echo "export LC_ALL=C" >> AppDir/apprun-hooks/linuxdeploy-plugin-gtk.sh
echo -e "export LC_ALL=C\nexport FONTCONFIG_PATH=/etc/fonts" >> AppDir/apprun-hooks/linuxdeploy-plugin-gtk.sh
VERSION="${GITVERSION}" ./mkappimage.AppImage --appimage-extract-and-run "${GITHUB_WORKSPACE}"/AppDir
mkdir -p "${GITHUB_WORKSPACE}"/artifacts/