meson support: create meson.build files

This commit contains the meson.build files necessary to build the
project and unit tests. The normal procedure is to run the command
'meson build' followed by ninja -C build. Additionally, service files
are copied to remove autoconf-style naming convention (they cannot be
  removed before autoconf files are removed).

Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I6cf8f5c1c923a198ad2fb4638843645479fd0498
diff --git a/presence/meson.build b/presence/meson.build
new file mode 100644
index 0000000..d3028d6
--- /dev/null
+++ b/presence/meson.build
@@ -0,0 +1,57 @@
+
+phosphor_fan_presence_include_directories = include_directories(
+    '.',
+    '..'
+)
+
+sources=[
+    'anyof.cpp',
+    'error_reporter.cpp',
+    'fallback.cpp',
+    'fan.cpp',
+    'get_power_state.cpp',
+    'gpio.cpp',
+    'json_parser.cpp',
+    'logging.cpp',
+    'psensor.cpp',
+    'tach.cpp',
+    'tach_detect.cpp'
+]
+
+deps=[
+    libevdev_dep,
+    phosphor_dbus_interfaces_dep,
+    phosphor_logging_dep,
+    sdbusplus_dep,
+    sdeventplus_dep
+]
+
+# Only needed for YAML config
+if get_option('json-config').disabled()
+    generated_hpp_dep = custom_target(
+        'generated.hpp',
+        input: files(
+            './pfpgen.py',
+            conf.get_unquoted('PRESENCE_YAML_FILE')
+        ),
+        command: [
+            python_prog, '@INPUT0@',
+            'generate-cpp',
+            '-i', '@INPUT1@'
+        ],
+        capture: true,
+        output: 'generated.hpp'
+    )
+
+    sources += generated_hpp_dep
+endif
+
+phosphor_fan_presence = executable(
+    'phosphor-fan-presence-tach',
+    sources,
+    dependencies : deps,
+    implicit_include_directories: false,
+    include_directories: phosphor_fan_presence_include_directories,
+    install: true
+)
+
diff --git a/presence/service_files/json/phosphor-fan-presence-tach@.service b/presence/service_files/json/phosphor-fan-presence-tach@.service
new file mode 100644
index 0000000..5cad843
--- /dev/null
+++ b/presence/service_files/json/phosphor-fan-presence-tach@.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Phosphor Fan Presence Tach Daemon
+After=mapper-wait@-xyz-openbmc_project-inventory.service
+
+[Service]
+Restart=on-failure
+ExecStart=/usr/bin/phosphor-fan-presence-tach
diff --git a/presence/service_files/yaml/phosphor-fan-presence-tach@.service b/presence/service_files/yaml/phosphor-fan-presence-tach@.service
new file mode 100644
index 0000000..33c2408
--- /dev/null
+++ b/presence/service_files/yaml/phosphor-fan-presence-tach@.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Phosphor Fan Presence Tach Daemon
+Wants=obmc-power-on@%i.target
+After=obmc-power-on@%i.target
+Conflicts=obmc-chassis-powered-off@%i.target
+
+[Service]
+Restart=on-failure
+ExecStart=/usr/bin/phosphor-fan-presence-tach
+SyslogIdentifier=phosphor-fan-presence-tach
+
+[Install]
+RequiredBy=obmc-chassis-poweron@%i.target
diff --git a/presence/test/fallbacktest.cpp b/presence/test/fallbacktest.cpp
index daa0b50..de4a54d 100644
--- a/presence/test/fallbacktest.cpp
+++ b/presence/test/fallbacktest.cpp
@@ -15,7 +15,7 @@
 {
 namespace presence
 {
-void setPresence(const Fan& fan, bool newState)
+void setPresence(const Fan&, bool newState)
 {
     if (newState)
     {
@@ -68,7 +68,7 @@
     // Validate a single sensor.
     // Validate on->off->on.
     pstate = -1;
-    Fan fan{"/path", "name"};
+    Fan fan{"/path", "name", 0};
     TestSensor ts;
     ts._present = true;
     std::vector<std::reference_wrapper<PresenceSensor>> sensors{ts};
@@ -99,7 +99,7 @@
     // Validate both sensors on->off->on
 
     pstate = -1;
-    Fan fan{"/path", "name"};
+    Fan fan{"/path", "name", 0};
     TestSensor ts1, ts2;
     ts1._present = true;
     ts2._present = true;
diff --git a/presence/test/meson.build b/presence/test/meson.build
new file mode 100644
index 0000000..15de777
--- /dev/null
+++ b/presence/test/meson.build
@@ -0,0 +1,20 @@
+
+test_include_directories = include_directories(
+    '../..'
+)
+
+test_deps=[
+    gmock_dep,
+    gtest_dep,
+]
+
+test(
+    'logger_test',
+    executable(
+        'logger_test',
+        'fallbacktest.cpp',
+        dependencies:test_deps,
+        implicit_include_directories: false,
+        include_directories: [test_include_directories]
+    )
+)