meson: add checks, defaults

Default to debugoptimized builds instead of the meson default of debug
since that is the autotools default.

Anything other than c++17 is not supported, so error out if something
else is selected by the user.

Make tiny builds even smaller by removing asserts and remove asserts for
release builds.

Change-Id: I034438263b1125c476dccb377dc52142415dddd2
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meson.build b/meson.build
index a6c067b..173f2ee 100644
--- a/meson.build
+++ b/meson.build
@@ -4,13 +4,23 @@
     default_options: [
         'warning_level=3',
         'werror=true',
-        'cpp_std=c++17'
+        'cpp_std=c++17',
+        'buildtype=debugoptimized',
+        'b_ndebug=if-release',
     ],
     license: 'Apache-2.0',
     version: '1.0',
 )
 add_project_arguments('-Wno-psabi', language: 'cpp')
 
+if get_option('cpp_std') != 'c++17'
+    error('This project requires c++17')
+endif
+
+if(get_option('buildtype') == 'minsize')
+    add_project_arguments('-DNDEBUG', language : 'cpp')
+endif
+
 cxx = meson.get_compiler('cpp')
 
 extra_sources = []