Fix sdbus++-gen-meson version warning
WARNING: Generated meson files from wrong version of
sdbus++-gen-meson.
WARNING: Expected "sdbus++-gen-meson version 1",
got: sdbus++-gen-meson version 3
Add the regenerate-meson file to automatically update meson.build.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: If1ce533bc0f6bafbe75d05595f9d36f5f652bd45
diff --git a/gen/regenerate-meson b/gen/regenerate-meson
new file mode 100755
index 0000000..a39ad64
--- /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/yaml" \
+ --output "$REPO_ROOT/gen"