From 8093902d95568f8de75aae763ca348783d483361 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Sat, 15 Sep 2018 11:37:06 +0200
Subject: Clean up waf options

---
 wscript | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

(limited to 'wscript')

diff --git a/wscript b/wscript
index 2b19152..3190c75 100644
--- a/wscript
+++ b/wscript
@@ -23,19 +23,17 @@ def options(opt):
     autowaf.set_options(opt)
 
     opt = opt.get_option_group('Configuration options')
-    flags = {
-        'no-gl':      'do not build OpenGL support',
-        'no-cairo':   'do not build Cairo support',
-        'static':     'build static library',
-        'log':        'print GL information to console',
-        'grab-focus': 'work around reparent keyboard issues by grabbing focus'}
-
-    for name, desc in flags.items():
-        opt.add_option('--' + name, action='store_true',
-                       dest=name.replace('-', '_'), help=desc)
-
     opt.add_option('--target', default=None, dest='target',
-                   help='Target platform (e.g. "win32" or "darwin")')
+                   help='target platform (e.g. "win32" or "darwin")')
+
+    autowaf.add_flags(
+        opt,
+        {'no-gl':      'do not build OpenGL support',
+         'no-cairo':   'do not build Cairo support',
+         'static':     'build static library',
+         'test':       'build test programs',
+         'log':        'print GL information to console',
+         'grab-focus': 'work around reparent keyboard issues by grabbing focus'})
 
 def configure(conf):
     conf.env.TARGET_PLATFORM = Options.options.target or sys.platform
@@ -64,11 +62,9 @@ def configure(conf):
         autowaf.define(conf, 'PUGL_VERBOSE', 1)
 
     # Shared library building is broken on win32 for some reason
-    conf.env['BUILD_TESTS']  = Options.options.build_tests
-    conf.env['BUILD_SHARED'] = (conf.env.TARGET_PLATFORM != 'win32' or
-                                Options.options.shared)
-    conf.env['BUILD_STATIC'] = (Options.options.build_tests or
-                                Options.options.static)
+    conf.env['BUILD_TESTS']  = Options.options.test
+    conf.env['BUILD_SHARED'] = conf.env.TARGET_PLATFORM != 'win32'
+    conf.env['BUILD_STATIC'] = (Options.options.test or Options.options.static)
 
     autowaf.define(conf, 'PUGL_VERSION', PUGL_VERSION)
     conf.write_config_header('pugl_config.h', remove=False)
-- 
cgit v1.2.3