meson: add options to disable benchmarks, examples, tools
authorTim-Philipp Müller <tim@centricular.com>
Wed, 3 Oct 2018 08:28:53 +0000 (09:28 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 3 Oct 2018 08:29:17 +0000 (09:29 +0100)
Like we have in other modules.

examples/meson.build
meson.build
meson_options.txt
testsuite/meson.build

index 6e76660..2a0e303 100644 (file)
@@ -1,5 +1,9 @@
 if not meson.is_cross_build()
 
+  if not have_tools
+    error('Need to build tools (orcc) to build examples.')
+  endif
+
   examples = ['example1', 'example2', 'example3', 'mt19937ar']
 
   foreach ex : examples
index e192218..7343175 100644 (file)
@@ -126,8 +126,17 @@ cdata.set_quoted('VERSION', meson.project_version())
 
 subdir('orc')
 subdir('orc-test')
-subdir('tools')
-subdir('examples')
+
+have_tools = not get_option('tools').disabled()
+if have_tools
+  subdir('tools')
+else
+  orcc = disabler() # for testsuite/orcc/
+endif
+
+if not get_option('examples').disabled()
+  subdir('examples')
+endif
 
 if not get_option('tests').disabled()
   subdir('testsuite')
index ad74d85..2e99f33 100644 (file)
@@ -1,3 +1,8 @@
 option('enable-backend', type : 'combo', choices : ['sse', 'mmx', 'neon', 'mips', 'altivec', 'c64x', 'all'], value : 'all')
+
+# Common feature options
+option('benchmarks', type : 'feature', value : 'auto', yield : true)
+option('examples', type : 'feature', value : 'auto', yield : true)
 option('gtk_doc', type : 'feature', value : 'auto', yield : true, description : 'Generate API documentation with gtk-doc')
 option('tests', type : 'feature', value : 'auto', yield : true)
+option('tools', type : 'feature', value : 'auto', yield : true)
index 668609e..dd4c20e 100644 (file)
@@ -40,4 +40,7 @@ foreach bin : noinst_bins
 endforeach
 
 subdir('orcc')
-subdir('benchmorc')
+
+if not get_option('benchmarks').disabled()
+  subdir('benchmorc')
+endif