浏览代码

Update build to generate GIR bindings

Billy Barrow 3 年之前
父节点
当前提交
5cda5b2315
共有 3 个文件被更改,包括 23 次插入2 次删除
  1. 二进制
      libpeer.so
  2. 19 1
      src/lib/meson.build
  3. 4 1
      src/toys/hello_world/Main.vala

二进制
libpeer.so


+ 19 - 1
src/lib/meson.build

@@ -72,5 +72,23 @@ sources += files('Util/TimeoutMap.vala')
 sources += files('Util/Streams.vala')
 sources += files('Application/Application.vala')
 
-libpeer = library('peer', sources, dependencies: dependencies, install: true, install_dir: [true, true, true])
+libpeer = shared_library('libpeer', sources,
+    name_prefix: '',
+    dependencies: dependencies,
+    install: true,
+    vala_gir: 'LibPeer-1.0.gir',
+    install_dir: [true, true, true, true]
+)
 libpeer_dep = declare_dependency(link_with: libpeer, include_directories: include_directories('.'))
+
+pkg = import('pkgconfig')
+pkg.generate(libpeer,
+    version : '0.1',
+    name : 'libpeer',)
+    
+g_ir_compiler = find_program('g-ir-compiler')
+custom_target('libpeer typelib', command: [g_ir_compiler, '--shared-library=libpeer.so', '--output', '@OUTPUT@', meson.current_build_dir() / 'LibPeer-1.0.gir'],
+              output: 'LibPeer-1.0.typelib',
+              depends: libpeer,
+              install: true,
+              install_dir: get_option('libdir') / 'girepository-1.0')

+ 4 - 1
src/toys/hello_world/Main.vala

@@ -11,10 +11,13 @@ namespace HelloWorldApp {
 
         public static int main(string[] args) {
             var t = new Main();
-            t.initialise("hello-world");
             while (true) {};
             return 0;
         }
+
+        public Main() {
+            initialise("hello-world");
+        }
         
         protected override void on_incoming_stream (StpInputStream stream) {
             var message_length = new uint8[1];