Add meson build

This commit is to add meson build.
and later, we will remove Autotools and replace it with meson build.

Tested: built openpower-occ-control successfully and Unit test passes.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I7f5fbc7150194a78f9b36bb256613fc70b834130
diff --git a/gen/README b/gen/README
new file mode 100644
index 0000000..71182b5
--- /dev/null
+++ b/gen/README
@@ -0,0 +1,2 @@
+This directory contains generated meson.build files from sdbus++-gen-meson.
+Do not edit them by hand.
diff --git a/gen/meson.build b/gen/meson.build
new file mode 100644
index 0000000..56193c7
--- /dev/null
+++ b/gen/meson.build
@@ -0,0 +1,14 @@
+# Generated file; do not modify.
+sdbuspp_gen_meson_ver = run_command(
+    sdbuspp_gen_meson_prog,
+    '--version',
+).stdout().strip().split('\n')[0]
+
+if sdbuspp_gen_meson_ver != 'sdbus++-gen-meson version 3'
+    warning('Generated meson files from wrong version of sdbus++-gen-meson.')
+    warning(
+        'Expected "sdbus++-gen-meson version 3", got:',
+        sdbuspp_gen_meson_ver
+    )
+endif
+
diff --git a/gen/org/meson.build b/gen/org/meson.build
new file mode 100644
index 0000000..6488f22
--- /dev/null
+++ b/gen/org/meson.build
@@ -0,0 +1,2 @@
+# Generated file; do not modify.
+subdir('open_power')
diff --git a/gen/org/open_power/OCC/Device/meson.build b/gen/org/open_power/OCC/Device/meson.build
new file mode 100644
index 0000000..0f287ad
--- /dev/null
+++ b/gen/org/open_power/OCC/Device/meson.build
@@ -0,0 +1,14 @@
+# Generated file; do not modify.
+generated_sources += custom_target(
+    'org/open_power/OCC/Device__cpp'.underscorify(),
+    input: [ '../../../../../org/open_power/OCC/Device.errors.yaml',  ],
+    output: [ 'error.cpp', 'error.hpp',  ],
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'cpp',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.current_source_dir() / '../../../../..',
+        'org/open_power/OCC/Device',
+    ],
+)
+
diff --git a/gen/org/open_power/OCC/meson.build b/gen/org/open_power/OCC/meson.build
new file mode 100644
index 0000000..7433b15
--- /dev/null
+++ b/gen/org/open_power/OCC/meson.build
@@ -0,0 +1,15 @@
+# Generated file; do not modify.
+subdir('Device')
+generated_others += custom_target(
+    'org/open_power/OCC/Device__markdown'.underscorify(),
+    input: [ '../../../../org/open_power/OCC/Device.errors.yaml',  ],
+    output: [ 'Device.md' ],
+    command: [
+        sdbuspp_gen_meson_prog, '--command', 'markdown',
+        '--output', meson.current_build_dir(),
+        '--tool', sdbusplusplus_prog,
+        '--directory', meson.current_source_dir() / '../../../..',
+        'org/open_power/OCC/Device',
+    ],
+)
+
diff --git a/gen/org/open_power/meson.build b/gen/org/open_power/meson.build
new file mode 100644
index 0000000..8eed05c
--- /dev/null
+++ b/gen/org/open_power/meson.build
@@ -0,0 +1,2 @@
+# Generated file; do not modify.
+subdir('OCC')
diff --git a/gen/regenerate-meson b/gen/regenerate-meson
new file mode 100755
index 0000000..56bc2c6
--- /dev/null
+++ b/gen/regenerate-meson
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+REPO_ROOT=$(git rev-parse --show-toplevel)
+
+# Find sdbus++-gen-meson
+#   1. Check $SDBUSPP_GEN_MESON
+#   2. Check in $PATH
+#   3. Check in subprojects/sdbusplus
+if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
+    SDBUSPP_GEN_MESON="$(which sdbus++-gen-meson 2> /dev/null)"
+fi
+if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
+    SDBUSPP_GEN_MESON="$REPO_ROOT/subprojects/sdbusplus/tools/sdbus++-gen-meson"
+fi
+if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
+    echo "Cannot find sdbus++-gen-meson ($SDBUSPP_GEN_MESON)."
+    exit 1
+fi
+
+$SDBUSPP_GEN_MESON \
+    --command meson \
+    --directory "$REPO_ROOT" \
+    --output "$REPO_ROOT/gen"
diff --git a/gen/run-ci b/gen/run-ci
new file mode 100755
index 0000000..d38927a
--- /dev/null
+++ b/gen/run-ci
@@ -0,0 +1,15 @@
+#!/bin/bash
+cd "$(dirname "$0")" || exit
+./regenerate-meson || exit
+rc=0
+git --no-pager diff --exit-code -- . || rc=$?
+untracked="$(git ls-files --others --exclude-standard -- .)" || rc=$?
+if [ -n "$untracked" ]; then
+  echo "Untracked files:" >&2
+  echo "$untracked" >&2
+  rc=1
+fi
+if (( rc != 0 )); then
+  echo "Generated meson files differ from expected values" >&2
+  exit 1
+fi