build: Add meson
Change-Id: Ic58b2ec92c185faa5efe0f40b2bbf6e21d6ed70c
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..327ea97
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/build*/
+/subprojects/*/
diff --git a/README.md b/README.md
index eb16f23..dedcf1d 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,5 @@
## To Build
To build this package, do the following steps:
- 1. ./bootstrap.sh
- 2. ./configure ${CONFIGURE_FLAGS}
- 3. make
-
-To full clean the repository again run `./bootstrap.sh clean`.
+ 1. meson build
+ 2. ninja -C build
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..cf1ec16
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,52 @@
+project(
+ 'kcsbridge',
+ 'cpp',
+ version: '0.1',
+ meson_version: '>=0.57.0',
+ default_options: [
+ 'warning_level=3',
+ 'cpp_std=c++20',
+ ])
+
+# 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)
+assert(has_cli11, 'CLI11 is required')
+
+executable(
+ 'kcsbridged',
+ 'kcsbridged.cpp',
+ implicit_include_directories: false,
+ dependencies: [
+ dependency(
+ 'boost',
+ modules: [
+ 'coroutine',
+ 'context',
+ ],
+ ),
+ cli11_dep,
+ dependency('phosphor-logging'),
+ dependency('sdbusplus'),
+ ],
+ cpp_args: [
+ '-DBOOST_ASIO_DISABLE_THREADS',
+ '-DBOOST_ALL_NO_LIB',
+ '-DBOOST_SYSTEM_NO_DEPRECATED',
+ '-DBOOST_ERROR_CODE_HEADER_ONLY',
+ '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
+ ],
+ install: true,
+ install_dir: get_option('bindir'))
+
+systemd = dependency('systemd')
+if systemd.found()
+ install_data(
+ 'phosphor-ipmi-kcs@.service',
+ install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'))
+endif