sdbus++: Fix meson dependency generation

All of the generated meson files optionally look for sdbus++ sources
that can be plumbed in to allow changes to the generator code to
correctly trigger rebuilds.

This will require adding a new variable prior to generated sources,
`sdbusplusplus_depfiles`. You can convert previous meson defitions with
the follwing.

```
sdbusplus_dep = dependency('sdbusplus')
sdbusplusplus_prog = find_program('sdbus++', native: true)
sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', native: true)
sdbusplusplus_depfiles = files()
if sdbusplus_dep.type_name() == 'internal'
  sdbusplusplus_depfiles = subproject('sdbusplus').get_variable('sdbusplusplus_depfiles')
endif
```

Change-Id: Ic2d5bafdbdd2595be8c44e0e616e590143639f21
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/example/meson.build b/example/meson.build
index 837c6f7..b338dc1 100644
--- a/example/meson.build
+++ b/example/meson.build
@@ -44,20 +44,10 @@
     dependencies: asio_dep,
 )
 
-calc_buildroot = meson.current_build_dir()
-calc_files = files(
-    run_command(
-        sdbusgen_prog,
-        '--tool', sdbusplusplus_prog,
-        '--output', calc_buildroot,
-        'net',
-        check: true
-    ).stdout().strip().split('\n')
-)
-
+subdir('net/poettering/Calculator')
 executable(
     'calculator-server',
     'calculator-server.cpp',
-    calc_files,
+    calculator_sources,
     dependencies: sdbusplus_dep,
 )
diff --git a/example/net/poettering/Calculator/meson.build b/example/net/poettering/Calculator/meson.build
new file mode 100644
index 0000000..f77fc5b
--- /dev/null
+++ b/example/net/poettering/Calculator/meson.build
@@ -0,0 +1,29 @@
+calculator_sources = []
+
+calculator_sources += custom_target(
+    'Calculator__cpp',
+    input: '../Calculator.interface.yaml',
+    output: [ 'server.cpp', 'server.hpp', 'client.hpp' ],
+    depend_files: sdbusplusplus_depfiles,
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'cpp',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.current_source_dir() / '../../..',
+        'net/poettering/Calculator',
+    ],
+)
+
+calculator_sources += custom_target(
+    'Calculator__errors',
+    input: '../Calculator.errors.yaml',
+    output: [ 'error.cpp', 'error.hpp' ],
+    depend_files: sdbusplusplus_depfiles,
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'cpp',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.current_source_dir() / '../../..',
+        'net/poettering/Calculator',
+    ],
+)