diff --git a/meson.build b/meson.build index 9eda048b..dae1c1ad 100644 --- a/meson.build +++ b/meson.build @@ -42,6 +42,7 @@ config_h.set('USE_OPENSSL', libssl_dep.found()) config_h.set('USE_LIBCANBERRA', libcanberra_dep.found()) config_h.set('USE_DBUS', dbus_glib_dep.found()) config_h.set('USE_PLUGIN', get_option('plugin')) +config_h.set('USE_GTK_FRONTEND', get_option('gtk-frontend')) config_h.set('G_DISABLE_SINGLE_INCLUDES', true) config_h.set('GTK_DISABLE_DEPRECATED', true) diff --git a/plugins/sysinfo/meson.build b/plugins/sysinfo/meson.build index 9b105caa..530873df 100644 --- a/plugins/sysinfo/meson.build +++ b/plugins/sysinfo/meson.build @@ -10,7 +10,7 @@ sysinfo_deps = [ ] sysinfo_includes = [] -sysinfo_cargs = [] +sysinfo_cargs = ['-DHAVE_CONFIG_H'] system = host_machine.system() if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'darwin' or system == 'freebsd' @@ -19,6 +19,10 @@ if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system = 'shared/df.c' ] + if get_option('gtk-frontend') + sysinfo_cargs += '-DUSE_GTK_FRONTEND' + endif + if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'freebsd' libpci = dependency('libpci', required: false, method: 'pkg-config') if libpci.found() @@ -30,6 +34,10 @@ if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system = pciids = join_paths(picidsdir, 'pci.ids') sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids) endif + if get_option('gtk-frontend') + sysinfo_deps += dependency('gtk+-3.0', version: '>= 3.22') + endif + sysinfo_includes += 'unix' sysinfo_sources += [ 'unix/backend.c', @@ -52,7 +60,7 @@ endif shared_module('sysinfo', sysinfo_sources, dependencies: sysinfo_deps, - include_directories: include_directories(sysinfo_includes), + include_directories: [config_h_include, include_directories(sysinfo_includes)], c_args: sysinfo_cargs, install: true, install_dir: plugindir, diff --git a/plugins/sysinfo/osx/backend.m b/plugins/sysinfo/osx/backend.m index 58b9485a..5929ed02 100644 --- a/plugins/sysinfo/osx/backend.m +++ b/plugins/sysinfo/osx/backend.m @@ -32,6 +32,10 @@ #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "format.h" #include "df.h" @@ -276,7 +280,7 @@ sysinfo_backend_get_network(void) static const char *sysinfo_detect_toolkit(void) { -#if defined(HAVE_GTK3) +#if defined(USE_GTK_FRONTEND) return "GTK3"; #else return NULL; diff --git a/plugins/sysinfo/unix/backend.c b/plugins/sysinfo/unix/backend.c index b53a201d..4f6654cd 100644 --- a/plugins/sysinfo/unix/backend.c +++ b/plugins/sysinfo/unix/backend.c @@ -19,7 +19,11 @@ #include -#if defined(HAVE_GTK3) +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(USE_GTK_FRONTEND) #include #endif #include "parse.h" @@ -175,7 +179,7 @@ char *sysinfo_backend_get_network(void) static const char *sysinfo_detect_toolkit(void) { -#if defined(HAVE_GTK3) +#if defined(USE_GTK_FRONTEND) return "GTK3"; #else return NULL; @@ -190,7 +194,7 @@ static const char *sysinfo_detect_display_backend(void) const gboolean session_wayland = session && g_ascii_strcasecmp(session, "wayland") == 0; /* Best-effort: ask GDK what it actually opened, if available. */ -#if defined(HAVE_GTK3) +#if defined(USE_GTK_FRONTEND) { GdkDisplay *display = gdk_display_get_default(); if (display) diff --git a/plugins/sysinfo/win32/backend.c b/plugins/sysinfo/win32/backend.c index e76402a7..c2d008dd 100644 --- a/plugins/sysinfo/win32/backend.c +++ b/plugins/sysinfo/win32/backend.c @@ -26,6 +26,10 @@ #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "../../../src/common/sysinfo/sysinfo.h" #include "../format.h" @@ -106,7 +110,7 @@ static char *get_memory_info (void) static const char *sysinfo_detect_toolkit(void) { -#if defined(HAVE_GTK3) +#if defined(USE_GTK_FRONTEND) return "GTK3"; #else return NULL; diff --git a/win32/zoitechat.props b/win32/zoitechat.props index d1641f3e..1fca9f00 100644 --- a/win32/zoitechat.props +++ b/win32/zoitechat.props @@ -17,7 +17,7 @@ - GTK_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;HAVE_X509_GET_SIGNATURE_NID;HAVE_SSL_CTX_GET_SSL_METHOD;DEFAULT_CERT_FILE="cert.pem";HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline;$(GtkDefines) + GTK_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;HAVE_X509_GET_SIGNATURE_NID;HAVE_SSL_CTX_GET_SSL_METHOD;DEFAULT_CERT_FILE="cert.pem";HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline $(YourDepsPath)\$(ZoiteChatPlatform)\release @@ -67,7 +67,6 @@ $(DepsRoot)\include\glib-2.0;$(DepsRoot)\lib\glib-2.0\include;$(DepsRoot)\include\libxml2 true - HAVE_GTK3 $(DepsRoot)\include\gtk-3.0;$(DepsRoot)\lib\gtk-3.0\include $(DepsRoot)\include\atk-1.0;$(DepsRoot)\include\cairo;$(DepsRoot)\include\pango-1.0;$(DepsRoot)\include\gdk-pixbuf-2.0;$(DepsRoot)\include\harfbuzz $(Gtk3);$(GtkCommon)