From 4912be6cff905adbfd90edd1919ffbc1bcef5b9e Mon Sep 17 00:00:00 2001 From: Vadim Lomovtsev Date: Fri, 29 Mar 2024 15:58:31 +0300 Subject: [PATCH] plugins/windows-notification: add meson build support Signed-off-by: Vadim Lomovtsev --- build-meson-windows.sh | 5 +- plugins/ice/meson.build | 1 + plugins/meson.build | 1 + plugins/windows-notification/meson.build | 74 ++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 plugins/windows-notification/meson.build diff --git a/build-meson-windows.sh b/build-meson-windows.sh index 338a6023..c8998dfc 100644 --- a/build-meson-windows.sh +++ b/build-meson-windows.sh @@ -18,14 +18,15 @@ prepare() configure() { arg=${1:-"none"} + encr=${2:-"auto"} local cmd="" if [ x"${arg}" == x"reconfig" ]; then cmd=--reconfigure fi mkdir -p $BUILD_DIR meson setup ${cmd} --prefix "$DIST_DIR" \ - --buildtype=debug \ - -D crypto-backend=gnutls \ + -D crypto-backend=${encr} \ + -D plugin-ice=enabled \ $PROJ_DIR $BUILD_DIR } diff --git a/plugins/ice/meson.build b/plugins/ice/meson.build index de66c2ed..1ec3302e 100644 --- a/plugins/ice/meson.build +++ b/plugins/ice/meson.build @@ -2,6 +2,7 @@ if crypto_backend == 'openssl' if get_option('plugin-ice').enabled() error('plugin-ice does not work with openssl backend yet') else + warning('plugin-ice is not enabled!') subdir_done() endif endif diff --git a/plugins/meson.build b/plugins/meson.build index ee2d53c8..67565f93 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -6,4 +6,5 @@ subdir('openpgp') subdir('rtp') if host_machine.system() == 'windows' subdir('win32-fonts') + subdir('windows-notification') endif diff --git a/plugins/windows-notification/meson.build b/plugins/windows-notification/meson.build new file mode 100644 index 00000000..005d9322 --- /dev/null +++ b/plugins/windows-notification/meson.build @@ -0,0 +1,74 @@ +dependencies = [ + dep_dino, + dep_gee, + dep_glib, + dep_gmodule, + dep_gtk4, + dep_qlite, + dep_xmpp_vala, +] + +sources = files( + 'src/windows_notifications_plugin.vala', + 'src/windows_notifications_register_plugin.vala', + 'src/toast_notification_builder.vala', + 'src/win_notification_provider.vala', + 'vapi/win32.vapi', + 'vapi/winrt.vapi', + 'vapi/shortcutcreator.vapi', + 'vapi/enums.vapi', + 'vapi/winrt_windows_ui_notifications.vapi', +) + +inc = include_directories( + 'api/include', + 'api/include/gobject', + 'yolort/include', +) + +sources += files( + 'api/src/gobject/winrt-enums.cpp', + 'api/src/gobject/winrt-event-token.cpp', + 'api/src/gobject/winrt-toast-notification.cpp', + 'api/src/gobject/winrt-toast-notifier.cpp', + 'api/src/gobject/winrt.cpp', + 'api/src/win32.cpp', + 'api/src/converter.cpp', + 'api/src/dyn_mod.cpp', + 'api/src/ginvoke.cpp', + 'api/src/shortcutcreator.cpp', +) + +c_args = [ + '-DG_LOG_DOMAIN="windows-notification"', + '-D_POSIX_C_SOURCE=1', + '-DGETTEXT_PACKAGE="dino"', +] + +cpp_args = [ + '-DWINRT_GLIB_H_INSIDE=1', + '-std=c++17', + '-iquote', meson.current_source_dir() / 'yolort/include/winrt/yolort_impl', +] + +vala_args = [ + '--vapidir', meson.current_source_dir() / 'vapi', +] + +link_args = [ + '-lshlwapi', '-lntdll' +] + +if dep_gtk4.version() == 'unknown' or dep_gtk4.version().version_compare('>=4.6') + vala_args += ['-D', 'GTK_4_6'] +endif +if dep_gtk4.version() == 'unknown' or dep_gtk4.version().version_compare('>=4.8') + vala_args += ['-D', 'GTK_4_8'] +endif + +if host_machine.system() == 'windows' + link_args += ['-Wl,--export-all-symbols'] +endif + +libwindows_notification = shared_library('windows-notification', sources: sources, include_directories: inc, name_prefix:'', c_args: c_args, vala_args:vala_args, dependencies: dependencies, install: true, install_dir: get_option('libdir')/'dino/plugins', link_args: link_args, cpp_args: cpp_args) +dep_windows_notification = declare_dependency(link_with: libwindows_notification, include_directories: include_directories('.'))