Add basic main and meson.build

Main just runs very 1 second, based on the asio timer example.

Tested: Added a debug fprint and verified that it runs every 1 second

Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I75c98a39f43d3f7103583171979ce87515c9083d
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..9db1969
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,31 @@
+#include <boost/asio.hpp>
+
+#include <chrono>
+#include <functional>
+
+namespace
+{
+// Set the read loop interval to be 1 second for now
+// TODO: Make this a configuration option
+static constexpr std::chrono::seconds readIntervalSec(1);
+} // namespace
+
+// boost::async_wait requires `const boost::system::error_code&` parameter
+void readLoop(boost::asio::steady_timer* t, const boost::system::error_code&)
+{
+    /* This will run every readIntervalSec second for now */
+    t->expires_from_now(readIntervalSec);
+    t->async_wait(std::bind_front(readLoop, t));
+}
+
+int main()
+{
+    boost::asio::io_context io;
+    boost::asio::steady_timer t(io, readIntervalSec);
+
+    t.async_wait(std::bind_front(readLoop, &t));
+
+    io.run();
+
+    return 0;
+}
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..1a4f80a
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,16 @@
+bios_bmc_smm_error_logger_pre = declare_dependency(
+  dependencies: [
+    dependency('threads'),
+  ])
+
+bios_bmc_smm_error_logger_dep = declare_dependency(
+  dependencies: bios_bmc_smm_error_logger_pre,)
+
+executable(
+  'bios-bmc-smm-error-logger',
+  'main.cpp',
+  implicit_include_directories: false,
+  dependencies: bios_bmc_smm_error_logger_dep,
+  install: true,
+  install_dir: get_option('bindir')
+)