build: add cereal dependencies
Numerous places are missing dependencies for Cereal, which makes the
repository impossible to build with meson subprojects. Add them and
the appropriate wrap file.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If20779983b9b062d7050dc323ccbae678ce58220
diff --git a/control/meson.build b/control/meson.build
index e5a6231..447f29f 100644
--- a/control/meson.build
+++ b/control/meson.build
@@ -8,7 +8,8 @@
phosphor_dbus_interfaces_dep,
phosphor_logging_dep,
sdbusplus_dep,
- sdeventplus_dep
+ sdeventplus_dep,
+ cereal_dep,
]
sources = ['main.cpp']
diff --git a/meson.build b/meson.build
index 423fee3..6ddc52e 100644
--- a/meson.build
+++ b/meson.build
@@ -19,7 +19,7 @@
cli11_dep = dependency('cli11', required: false)
-if not meson.get_compiler('cpp').has_header_symbol(
+if not cpp.has_header_symbol(
'CLI/CLI.hpp',
'CLI::App',
dependencies: cli11_dep,
@@ -29,6 +29,23 @@
cli11_dep = cli11_proj.get_variable('CLI11_dep')
endif
+cereal_dep = dependency('cereal', required: false)
+has_cereal = cpp.has_header_symbol(
+ 'cereal/cereal.hpp',
+ 'cereal::specialize',
+ dependencies: cereal_dep,
+ required: false)
+if not has_cereal
+ cereal_opts = import('cmake').subproject_options()
+ cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
+ cereal_proj = import('cmake').subproject(
+ 'cereal',
+ options: cereal_opts,
+ required: false)
+ assert(cereal_proj.found(), 'cereal is required')
+ cereal_dep = cereal_proj.dependency('cereal')
+endif
+
fmt_dep = dependency('fmt')
json_dep = declare_dependency()
diff --git a/sensor-monitor/meson.build b/sensor-monitor/meson.build
index 64f8b16..adaa653 100644
--- a/sensor-monitor/meson.build
+++ b/sensor-monitor/meson.build
@@ -12,7 +12,8 @@
deps=[
phosphor_dbus_interfaces_dep,
phosphor_logging_dep,
- sdeventplus_dep
+ sdeventplus_dep,
+ cereal_dep,
]
phosphor_fan_sensor_monitor = executable(
diff --git a/subprojects/cereal.wrap b/subprojects/cereal.wrap
new file mode 100644
index 0000000..11c1d8b
--- /dev/null
+++ b/subprojects/cereal.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/USCiLab/cereal.git
+revision = HEAD