meson: Don't use get_option('buildtype')
authorNirbheek Chauhan <nirbheek@centricular.com>
Fri, 3 Apr 2020 11:37:47 +0000 (17:07 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Fri, 3 Apr 2020 11:37:47 +0000 (17:07 +0530)
We should directly check the values of the `debug` and `optimization`
options instead.

`get_option('buildtype')` will return `'custom'` for most combinations
of `-Doptimization` and `-Ddebug`, but those two will always be set
correctly if only `-Dbuildtype` is set. So we should look at those
options directly.

For the two-way mapping between `buildtype` and `optimization`
+ `debug`, see this table:
https://mesonbuild.com/Builtin-options.html#build-type-options

ext/vulkan/shaders/meson.build
meson.build
sys/d3d11/meson.build

index f822dd0..6048f63 100644 (file)
@@ -18,17 +18,16 @@ bin2array = find_program('bin2array.py')
 # FIXME: meson compiler class instead?
 glslc_build_options = []
 optimization = get_option('optimization')
-buildtype = get_option('buildtype')
-if get_option('debug') or optimization == 'g' or ['debug', 'debugoptimized'].contains(buildtype)
+if get_option('debug')
   glslc_build_options += ['-g']
 endif
 if get_option('werror')
   glslc_build_options += ['-Werror']
 endif
-if buildtype == 'minsize' or optimization == 's'
+if optimization == 's'
   glslc_build_options += ['-Os']
 endif
-if ['release', 'debugoptimized'].contains(buildtype) or ['1', '2', '3'].contains(optimization)
+if optimization in ['1', '2', '3']
   glslc_build_options += ['-O']
 endif
 
index 92b2710..5f99289 100644 (file)
@@ -1,6 +1,6 @@
 project('gst-plugins-bad', 'c', 'cpp',
   version : '1.17.0.1',
-  meson_version : '>= 0.48',
+  meson_version : '>= 0.49',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized' ])
 
index 53f1b71..dad075c 100644 (file)
@@ -86,7 +86,7 @@ if not have_d3d11
 endif
 
 # for enabling debug layer
-if get_option('buildtype').startswith('debug')
+if get_option('debug')
   d3d11_debug_libs = [
     ['d3d11sdklayers.h', 'ID3D11Debug', 'ID3D11InfoQueue', 'have_d3d11sdk_h'],
     ['dxgidebug.h', 'IDXGIDebug', 'IDXGIInfoQueue', 'have_dxgidebug_h'],