summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-01-15 18:27:13 -0800
committerWilliam A. Kennington III <wak@google.com>2019-03-06 21:47:55 +0000
commitb93377104292de0f94087c0cbb79d4d6d8516b84 (patch)
tree3ccf01c66d4c3972c6d10ac39bb9f206c73f7596
parent976764158af29113103a9a6acd8911f4f06c6b27 (diff)
downloadphosphor-watchdog-b93377104292de0f94087c0cbb79d4d6d8516b84.tar.gz
phosphor-watchdog-b93377104292de0f94087c0cbb79d4d6d8516b84.zip
meson: Add alternate build system
For now we will support both the autotools and meson build systems alongside each other, until support for meson is ready across the ecosystem. Tested: Run through build and unit tests that leverage the new build system and all of the tests pass and the install puts phosphor-watchdog in the correct location. Change-Id: I0454e763acc648ac76efd7728f6da498d9acf5dd Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--meson.build43
-rw-r--r--meson_options.txt1
-rw-r--r--test/meson.build13
3 files changed, 57 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..75d19e6
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,43 @@
+project('phosphor-watchdog', 'cpp',
+ version: '0.1', meson_version: '>=0.49.0',
+ default_options: [
+ 'warning_level=3',
+ 'werror=true',
+ 'cpp_std=c++17'
+ ])
+
+build_tests = get_option('tests')
+
+phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
+phosphor_logging = dependency('phosphor-logging')
+sdbusplus = dependency('sdbusplus')
+sdeventplus = dependency('sdeventplus')
+
+libwatchdog = static_library(
+ 'watchdog',
+ 'watchdog.cpp',
+ implicit_include_directories: false,
+ dependencies: [
+ phosphor_dbus_interfaces,
+ phosphor_logging,
+ sdbusplus,
+ sdeventplus,
+ ])
+
+executable(
+ 'phosphor-watchdog',
+ 'mainapp.cpp',
+ implicit_include_directories: false,
+ link_with: libwatchdog,
+ dependencies: [
+ phosphor_logging,
+ phosphor_dbus_interfaces,
+ sdbusplus,
+ sdeventplus,
+ ],
+ install: true,
+ install_dir: get_option('sbindir'))
+
+if not build_tests.disabled()
+ subdir('test')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..0fc2767
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('tests', type: 'feature', description: 'Build tests')
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..4218665
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,13 @@
+gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
+gmock = dependency('gmock', disabler: true, required: build_tests)
+
+tests = [
+ 'watchdog',
+]
+
+foreach t : tests
+ test(t, executable(t.underscorify(), t + '.cpp',
+ implicit_include_directories: false,
+ link_with: libwatchdog,
+ dependencies: [gtest, gmock]))
+endforeach
OpenPOWER on IntegriCloud