aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-15 08:53:42 +0200
committerDavid Robillard <d@drobilla.net>2018-09-15 08:53:42 +0200
commit8239fedfd133916f0ac26bd85ff524afca243ddb (patch)
treebe2cf7adccd7d95ef88b23ae1a6b3b5aeb68a5cd
parentb6e9de2de9725e2f5a3170b8171ad1a1e95e8339 (diff)
downloadpugl-8239fedfd133916f0ac26bd85ff524afca243ddb.tar.gz
pugl-8239fedfd133916f0ac26bd85ff524afca243ddb.tar.bz2
pugl-8239fedfd133916f0ac26bd85ff524afca243ddb.zip
Squashed 'waflib/' changes from 391d285..542b3f5
542b3f5 Beautify configuration summary output 7cd395c fixup! version 8a706da Add msgs argument to autowaf.display_summary() and show flags a8ea0a0 Automatically define version 7efd6d7 Add autowaf.add_flags() for terse flag definition git-subtree-dir: waflib git-subtree-split: 542b3f59c13b40388ef68f5aa6a386d72f419017
-rw-r--r--extras/autowaf.py33
1 files changed, 28 insertions, 5 deletions
diff --git a/extras/autowaf.py b/extras/autowaf.py
index 243ab05..d6b1219 100644
--- a/extras/autowaf.py
+++ b/extras/autowaf.py
@@ -11,7 +11,7 @@ import os
import subprocess
import sys
-from waflib import Build, Logs, Options, Utils
+from waflib import Build, Context, Logs, Options, Utils
from waflib.TaskGen import feature, before, after
global g_is_child
@@ -93,6 +93,11 @@ def set_options(opt, debug_by_default=False, test=False):
g_step = 1
+def add_flags(opt, flags):
+ for name, desc in flags.items():
+ opt.add_option('--' + name, action='store_true',
+ dest=name.replace('-', '_'), help=desc)
+
def get_check_func(conf, lang):
if lang == 'c':
return conf.check_cc
@@ -294,18 +299,32 @@ def configure(conf):
except:
pass # Test options do not exist
+ # Define version in configuration
+ appname = getattr(Context.g_module, Context.APPNAME, 'noname')
+ version = getattr(Context.g_module, Context.VERSION, '0.0.0')
+ define(conf, appname.upper() + '_VERSION', version)
+
conf.env.prepend_value('CFLAGS', '-I' + os.path.abspath('.'))
conf.env.prepend_value('CXXFLAGS', '-I' + os.path.abspath('.'))
g_step = 2
-def display_summary(conf):
+def display_summary(conf, msgs=None):
global g_is_child
Logs.pprint('', '')
if not g_is_child:
display_msg(conf, "Install prefix", conf.env['PREFIX'])
- display_msg(conf, "Debuggable build", bool(conf.env['DEBUG']))
+ if 'COMPILER_CC' in conf.env:
+ display_msg(conf, "C Flags", ' '.join(conf.env['CFLAGS']))
+ if 'COMPILER_CXX' in conf.env:
+ display_msg(conf, "C++ Flags", ' '.join(conf.env['CXXFLAGS']))
+ display_msg(conf, "Debuggable", bool(conf.env['DEBUG']))
display_msg(conf, "Build documentation", bool(conf.env['DOCS']))
+ if msgs is not None:
+ display_msgs(conf, msgs)
+
+ Logs.pprint('', '')
+
def set_c_lang(conf, lang):
"Set a specific C language standard, like 'c99' or 'c11'"
if conf.env.MSVC_COMPILER:
@@ -431,10 +450,14 @@ def display_msg(conf, msg, status = None, color = None):
elif type(status) == bool and not status or status == "False":
color = 'YELLOW'
status = 'no'
- Logs.pprint('NORMAL', ' %s' % msg.ljust(conf.line_just - 2), sep='')
- Logs.pprint('NORMAL', ":", sep='')
+ Logs.pprint('BOLD', '%s' % msg.ljust(conf.line_just), sep='')
+ Logs.pprint('BOLD', ":", sep='')
Logs.pprint(color, status)
+def display_msgs(conf, msgs):
+ for k, v in msgs.items():
+ display_msg(conf, k, v)
+
def link_flags(env, lib):
return ' '.join(map(lambda x: env['LIB_ST'] % x, env['LIB_' + lib]))