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/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()