build: add meson and subproject wrap files
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I810d8ba10135b984ef864013d579b1461d843ba9
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..3b32813
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,70 @@
+project(
+ 'ipmbbridge',
+ 'cpp',
+ version: '0.1',
+ meson_version: '>=0.57.0',
+ default_options: [
+ 'warning_level=3',
+ 'werror=true',
+ 'cpp_std=c++20',
+ ],
+)
+
+cpp = meson.get_compiler('cpp')
+add_project_arguments(
+ cpp.get_supported_arguments([
+ '-DBOOST_ERROR_CODE_HEADER_ONLY',
+ '-DBOOST_SYSTEM_NO_DEPRECATED',
+ '-DBOOST_ALL_NO_LIB',
+ '-DBOOST_NO_RTTI',
+ '-DBOOST_NO_TYPEID',
+ '-DBOOST_ASIO_DISABLE_THREADS',
+ ]),
+ language: 'cpp',
+)
+
+if cpp.has_header('nlohmann/json.hpp')
+ nlohmann_json_dep = declare_dependency()
+else
+ subproject('nlohmann-json')
+ nlohmann_json_dep = declare_dependency(
+ include_directories: include_directories(
+ 'subprojects/nlohmann-json/single_include',
+ 'subprojects/nlohmann-json/single_include/nlohmann',
+ )
+ )
+endif
+
+boost_dep = dependency(
+ 'boost',
+ modules: ['coroutine'],
+ include_type: 'system',
+)
+i2c_dep = cpp.find_library('i2c')
+phosphor_logging_dep = dependency('phosphor-logging')
+sdbusplus_dep = dependency('sdbusplus')
+systemd_dep = dependency('systemd')
+
+executable(
+ 'ipmbbridge',
+ 'ipmbbridged.cpp',
+ 'ipmbutils.cpp',
+ dependencies: [
+ boost_dep,
+ i2c_dep,
+ nlohmann_json_dep,
+ phosphor_logging_dep,
+ sdbusplus_dep,
+ ],
+ install: true,
+)
+
+install_data(
+ 'ipmb.service',
+ install_dir: systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir'),
+)
+
+install_data(
+ 'ipmb-channels.json',
+ install_dir: get_option('datadir') / 'ipmbbridge',
+)
diff --git a/subprojects/nlohmann-json.wrap b/subprojects/nlohmann-json.wrap
new file mode 100644
index 0000000..a77b7c9
--- /dev/null
+++ b/subprojects/nlohmann-json.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+revision = b3e5cb7f20dcc5c806e418df34324eca60d17d4e
+url = https://github.com/nlohmann/json.git
diff --git a/subprojects/phosphor-logging.wrap b/subprojects/phosphor-logging.wrap
new file mode 100644
index 0000000..71eee8b
--- /dev/null
+++ b/subprojects/phosphor-logging.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/openbmc/phosphor-logging.git
+revision = HEAD
+
+[provide]
+phosphor-logging = phosphor_logging_dep
diff --git a/subprojects/sdbusplus.wrap b/subprojects/sdbusplus.wrap
new file mode 100644
index 0000000..7b076d0
--- /dev/null
+++ b/subprojects/sdbusplus.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/openbmc/sdbusplus.git
+revision = HEAD
+
+[provide]
+sdbusplus = sdbusplus_dep