meson: add memory-alignment option
authorTim-Philipp Müller <tim@centricular.com>
Thu, 9 Aug 2018 23:33:58 +0000 (00:33 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 9 Aug 2018 23:34:29 +0000 (00:34 +0100)
meson.build
meson_options.txt

index 834e15d..84a07b3 100644 (file)
@@ -74,14 +74,21 @@ cdata.set_quoted('PACKAGE_URL', '')
 cdata.set_quoted('PACKAGE_VERSION', gst_version)
 cdata.set_quoted('PLUGINDIR', join_paths(get_option('prefix'), get_option('libdir'), 'gstreamer-1.0'))
 cdata.set_quoted('VERSION', gst_version)
-# FIXME: --with-memory-alignment],[8,N,malloc,pagesize (default is 32)]) option
-cdata.set('MEMORY_ALIGNMENT_MALLOC', 1)
 cdata.set_quoted('GST_PLUGIN_SCANNER_INSTALLED', join_paths(prefix, helpers_install_dir, 'gst-plugin-scanner'))
 cdata.set_quoted('GST_PTP_HELPER_INSTALLED', join_paths(prefix, helpers_install_dir, 'gst-ptp-helper'))
 cdata.set_quoted('GST_PLUGIN_SCANNER_SUBDIR', libexecdir,
   description: 'libexecdir path component, used to find plugin-scanner on relocatable builds on windows')
 cdata.set('GST_DISABLE_OPTION_PARSING', not get_option('option-parsing'))
 
+mem_align_opt = get_option('memory-alignment')
+if mem_align_opt == 'malloc'
+  cdata.set('MEMORY_ALIGNMENT_MALLOC', 1)
+elif mem_align_opt == 'pagesize'
+  cdata.set('MEMORY_ALIGNMENT_PAGESIZE', 1)
+else
+  cdata.set('MEMORY_ALIGNMENT', mem_align_opt.to_int())
+endif
+
 if host_system == 'darwin'
   cdata.set_quoted('GST_EXTRA_MODULE_SUFFIX', '.dylib')
 endif
index cc34a20..fbb0a9c 100644 (file)
@@ -13,6 +13,9 @@ option('extra-checks', type : 'boolean', value : true, description : 'Enable ext
 option('option-parsing', type : 'boolean', value : true,
        description: 'Enable command line option parsing')
 option('poisoning', type : 'boolean', value : false, description : 'Enable poisoning of deallocated objects')
+option('memory-alignment', type: 'combo',
+       choices : ['1', '2', '4', '8', '16', '32', '64', '128', '256', '512', '1024', '2048', '4096', '8192', 'malloc', 'pagesize'],
+       value: 'malloc')
 
 # Feature options
 option('libunwind', type : 'feature', value : 'auto', description : 'Use libunwind to generate backtraces')