build: add basic meson config
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0115a90b4f82c16cc15c4ce49cde3db084a39999
diff --git a/.gitignore b/.gitignore
index eded194..6da54be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,72 +1,3 @@
-# Template from:
-# https://github.com/github/gitignore/blob/master/Autotools.gitignore
-
-# http://www.gnu.org/software/automake
-
-
-# Code Coverage
-*.gcda
-*.gcno
-*.trs
-*-coverage*
-
-Makefile.in
-/ar-lib
-/mdate-sh
-/py-compile
-/test-driver
-/ylwrap
-
-# http://www.gnu.org/software/autoconf
-
-/aminclude_static.am
-/autom4te.cache
-/autoscan.log
-/autoscan-*.log
-/aclocal.m4
-/compile
-/config.guess
-/config.h.in
-/config.sub
-/configure
-/configure.scan
-/depcomp
-/install-sh
-/missing
-/stamp-h1
-
-# https://www.gnu.org/software/libtool/
-
-/ltmain.sh
-
-# http://www.gnu.org/software/texinfo
-
-/texinfo.tex
-
-# Repo Specific Items
-*.o
-/config.h
-/config.h.in~
-/config.log
-/config.status
-Makefile
-.deps
-.dirstamp
-/lib*
-.libs/
-/*-libtool
-/ipmid
-.project
-/test/*_unittest
-/test/*.log
-/test/*.trs
-
-# ignore vim swap files
-.*.sw*
-# failures from patch
-*.orig
-*.rej
-# backup files from some editors
-*~
-.cscope/
-build/
+build*/
+subprojects/*
+!subprojects/*.wrap
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..dfcad3d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,47 @@
+project(
+ 'phosphor-ipmi-ethstats',
+ 'cpp',
+ version: '1.0',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'cpp_std=c++23',
+ 'warning_level=3',
+ 'werror=true',
+ ],
+ meson_version: '>=1.1.1',
+)
+
+conf_data = configuration_data()
+conf_data.set('ENABLE_GOOGLE', get_option('google_oen').allowed().to_int())
+configure_file(
+ output: 'config.h',
+ configuration: conf_data,
+)
+
+ipmid_dep = dependency('libipmid')
+
+ethstatscmd_common_lib = static_library(
+ 'ethstatscmd_common',
+ 'ethstats.cpp',
+ 'handler.cpp',
+ dependencies: [
+ ipmid_dep,
+ ],
+)
+
+ethstatscmd_common_dep = declare_dependency(
+ link_with: ethstatscmd_common_lib,
+)
+
+ethstatscmd_lib = library(
+ 'ethstatscmd',
+ 'main.cpp',
+ dependencies: [
+ ethstatscmd_common_dep,
+ ipmid_dep,
+ ],
+ override_options: [ 'b_lundef=false' ],
+ version: meson.project_version(),
+ install: true,
+ install_dir: get_option('libdir') / 'ipmid-providers',
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..5b73cce
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
+option(
+ 'google_oen',
+ type: 'feature',
+ value: 'enabled',
+ description: 'Enable the Google OEN handler',
+)
diff --git a/subprojects/phosphor-host-ipmid.wrap b/subprojects/phosphor-host-ipmid.wrap
new file mode 100644
index 0000000..29bb550
--- /dev/null
+++ b/subprojects/phosphor-host-ipmid.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+url = https://github.com/openbmc/phosphor-host-ipmid.git
+revision = HEAD
+
+[provide]
+libipmid = ipmid_dep
+libchannellayer = channellayer_dep
+libuserlayer = userlayer_dep