summaryrefslogtreecommitdiff
path: root/lib/meson.build
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-06-20 16:27:42 +0200
committerHannes Schulze <haschu0103@outlook.de>2025-06-20 16:27:42 +0200
commit519956797d905c0925b8dd418ceb17c7495ad30a (patch)
tree5a26d1b6df1ddce517a47d3105761820b29a8953 /lib/meson.build
parent1af3d14f3f995645a0de08a54b244c19840709e9 (diff)
set up haskell bindings for c lib
Diffstat (limited to 'lib/meson.build')
-rw-r--r--lib/meson.build90
1 files changed, 90 insertions, 0 deletions
diff --git a/lib/meson.build b/lib/meson.build
new file mode 100644
index 0000000..473ac62
--- /dev/null
+++ b/lib/meson.build
@@ -0,0 +1,90 @@
+project('foobar', 'c', default_options: ['c_std=gnu11', 'warning_level=1'])
+
+gnome = import('gnome')
+glib_dep = dependency('glib-2.0', version: '>=2.78')
+gio_dep = dependency('gio-2.0', version: '>=2.78')
+
+deps = [
+ glib_dep,
+ gio_dep,
+]
+
+sources = []
+
+sources += gnome.gdbus_codegen(
+ 'server',
+ 'dbus/com.github.hannesschulze.foobar.xml',
+ namespace: 'Foobar',
+ annotations: [
+ ['com.github.hannesschulze.foobar.Server', 'org.gtk.GDBus.C.Name', 'Server'],
+ ],
+)
+
+sources += gnome.gdbus_codegen(
+ 'notifications',
+ 'dbus/org.freedesktop.Notifications.xml',
+ namespace: 'Foobar',
+ annotations: [
+ ['org.freedesktop.Notifications', 'org.gtk.GDBus.C.Name', 'Notifications'],
+ ],
+)
+
+sources += gnome.gdbus_codegen(
+ 'upower',
+ 'dbus/org.freedesktop.UPower.xml',
+ namespace: 'Foobar',
+ annotations: [
+ ['org.freedesktop.UPower.Device', 'org.gtk.GDBus.C.Name', 'UPowerDevice'],
+ ],
+)
+
+sources += gnome.gdbus_codegen(
+ 'bluez',
+ 'dbus/org.bluez.xml',
+ namespace: 'Foobar',
+ annotations: [
+ ['org.bluez.Adapter1', 'org.gtk.GDBus.C.Name', 'BluezAdapter'],
+ ['org.bluez.Device1', 'org.gtk.GDBus.C.Name', 'BluezDevice'],
+ ['org.bluez.AgentManager1', 'org.gtk.GDBus.C.Name', 'BluezAgentManager'],
+ ],
+)
+
+c_args = [
+ '-Wall',
+ '-Werror',
+ '-Wswitch-enum',
+ '-Wswitch-default',
+ '-Wunused',
+ '-Wuninitialized',
+]
+
+static_library(
+ 'foobar_static',
+ sources,
+ dependencies: deps,
+ install: false,
+ c_args: c_args
+)
+
+libfoobar = shared_library(
+ 'foobar',
+ sources,
+ dependencies: deps,
+ install: false,
+ c_args: c_args
+)
+
+libfoobar_gir = gnome.generate_gir(
+ libfoobar,
+ sources: sources,
+ namespace: 'Foobar',
+ link_with: libfoobar,
+ nsversion: '1.0.0',
+ identifier_prefix: 'Foobar',
+ symbol_prefix: 'foobar',
+ export_packages: 'foobar',
+ dependencies: deps,
+ includes: [ 'GObject-2.0', 'Gio-2.0' ],
+ install: false,
+ extra_args: [ '--fallback-library-path=' ]
+)