Enable Meson option to build parser and test cases

Meson script to build parser and test cases.
It will replace the use of auto tools to
build the code.

- Steps to build
In the directory, where you have meson.build file
execute the following commands.

meson -Doption=value builddir
<This will create a builddir>

ninja -C builddir
<Creates EXE>

ninja -C builddir test
<Executes unit tests>

Change-Id: Ic351daf2c135b06e1b04048a4a6ad8d9897fba54
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..a8f9793
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,60 @@
+if get_option('oe-sdk').enabled()
+  # Setup OE SYSROOT
+  OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
+  if OECORE_TARGET_SYSROOT == ''
+      error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.')
+  endif
+  message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT)
+  rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'])
+  ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip()
+  dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
+else
+  dynamic_linker = []
+endif
+
+gmock = dependency('gmock', disabler: true, required: build_tests)
+gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
+
+application_src = ['../impl.cpp']
+
+test('store_test', executable('store_test',
+        ['store/store.cpp', application_src],
+build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+
+link_args: dynamic_linker,
+dependencies: [
+            gtest,
+            gmock,
+            sdbusplus,
+            phosphor_logging,
+    ],
+include_directories: '..'
+),
+workdir: meson.current_source_dir())
+
+vpd_test = ['ipz_parser/parser.cpp',
+                'keyword_vpd_parser_test/kw_vpd_test.cpp'
+    ]
+application_src += ['../keyword_vpd_parser.cpp',
+  '../vpdecc/vpdecc.c',
+  '../vpdecc/vpdecc_support.c'
+    ]
+foreach t : vpd_test
+    test(t, executable(t.underscorify(),
+            [t, application_src],
+    build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+
+    link_args: dynamic_linker,
+    cpp_args: '-DIPZ_PARSER',
+    c_args: ['-Wno-unused-parameter',
+      '-Wno-unused-variable'],
+    dependencies: [
+                gtest,
+                gmock,
+                sdbusplus,
+                phosphor_logging,
+        ],
+    include_directories: '..'
+    ),
+    workdir: meson.current_source_dir())
+endforeach