Move source into src directory
This makes the source more distinguishable from top-level metadata.
Change-Id: I5e41186d4606422937ec7d37402a3031d3f776b6
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..63fae3d
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,43 @@
+watchdog_headers = include_directories('.')
+
+# CLI11 might not have a pkg-config. It is header only so just make
+# sure we can access the needed symbols from the header.
+cli11_dep = dependency('cli11', required: false)
+has_cli11 = meson.get_compiler('cpp').has_header_symbol(
+ 'CLI/CLI.hpp',
+ 'CLI::App',
+ dependencies: cli11_dep,
+ required: false)
+if not has_cli11
+ cli11_proj = subproject('cli11', required: false)
+ assert(cli11_proj.found(), 'CLI11 is required')
+ cli11_dep = cli11_proj.get_variable('CLI11_dep')
+endif
+
+watchdog_deps = [
+ cli11_dep,
+ dependency('phosphor-dbus-interfaces'),
+ dependency('phosphor-logging'),
+ dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
+ dependency('sdeventplus', fallback: ['sdeventplus', 'sdeventplus_dep']),
+]
+
+watchdog_lib = static_library(
+ 'watchdog',
+ 'watchdog.cpp',
+ implicit_include_directories: false,
+ include_directories: watchdog_headers,
+ dependencies: watchdog_deps)
+
+watchdog_dep = declare_dependency(
+ dependencies: watchdog_deps,
+ include_directories: watchdog_headers,
+ link_with: watchdog_lib)
+
+executable(
+ 'phosphor-watchdog',
+ 'mainapp.cpp',
+ implicit_include_directories: false,
+ dependencies: watchdog_dep,
+ install: true,
+ install_dir: get_option('bindir'))