Use WafToolchainFlags from git submodule
This commit is contained in:
parent
21a3d589b1
commit
a750039aa9
|
@ -7,3 +7,6 @@
|
|||
[submodule "siginfo"]
|
||||
path = siginfo
|
||||
url = ../siginfo
|
||||
[submodule "waftoolchainflags"]
|
||||
path = waftoolchainflags
|
||||
url = ../waf-toolchain-flags
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit c71e02562fdd089c930412166412b5473f19e1da
|
81
wscript
81
wscript
|
@ -27,6 +27,7 @@ import sys
|
|||
from waflib import Logs, Options, TaskGen
|
||||
from waflib import Context
|
||||
from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
|
||||
from waftoolchainflags import WafToolchainFlags
|
||||
|
||||
VERSION = "2.22.1"
|
||||
APPNAME = 'jackdbus'
|
||||
|
@ -110,86 +111,6 @@ def detect_platform(conf):
|
|||
conf.end_msg(name, color='CYAN')
|
||||
break
|
||||
|
||||
class WafToolchainFlags:
|
||||
"""
|
||||
Waf helper class for handling set of CFLAGS
|
||||
and related. The flush() method will
|
||||
prepend so to allow supplied by (downstream/distro/builder) waf caller flags
|
||||
to override the upstream flags in wscript.
|
||||
TODO: upstream this or find alternative easy way of doing the same
|
||||
"""
|
||||
def __init__(self, conf):
|
||||
"""
|
||||
:param conf: Waf configuration object
|
||||
"""
|
||||
self.conf = conf
|
||||
self.flags = {}
|
||||
for x in ('CPPFLAGS', 'CFLAGS', 'CXXFLAGS', 'LINKFLAGS'):
|
||||
self.flags[x] = []
|
||||
|
||||
def flush(self):
|
||||
"""
|
||||
Flush flags to the configuration object
|
||||
Prepend is used so to allow supplied by
|
||||
(downstream/distro/builder) waf caller flags
|
||||
to override the upstream flags in wscript.
|
||||
"""
|
||||
for key, val in self.flags.items():
|
||||
self.conf.env.prepend_value(key, val)
|
||||
|
||||
def add(self, key, val):
|
||||
"""
|
||||
:param key: Set to add flags to. 'CPPFLAGS', 'CFLAGS', 'CXXFLAGS' or 'LINKFLAGS'
|
||||
:param val: string or list of strings
|
||||
"""
|
||||
flags = self.flags[key]
|
||||
if isinstance(val, list):
|
||||
#flags.extend(val)
|
||||
for x in val:
|
||||
if not isinstance(x, str):
|
||||
raise Exception("value must be string or list of strings. ", type(x))
|
||||
flags.append(x)
|
||||
elif isinstance(val, str):
|
||||
flags.append(val)
|
||||
else:
|
||||
raise Exception("value must be string or list of strings")
|
||||
|
||||
def add_cpp(self, value):
|
||||
"""
|
||||
Add flag or list of flags to CPPFLAGS
|
||||
:param value: string or list of strings
|
||||
"""
|
||||
self.add('CPPFLAGS', value)
|
||||
|
||||
def add_c(self, value):
|
||||
"""
|
||||
Add flag or list of flags to CFLAGS
|
||||
:param value: string or list of strings
|
||||
"""
|
||||
self.add('CFLAGS', value)
|
||||
|
||||
def add_cxx(self, value):
|
||||
"""
|
||||
Add flag or list of flags to CXXFLAGS
|
||||
:param value: string or list of strings
|
||||
"""
|
||||
self.add('CXXFLAGS', value)
|
||||
|
||||
def add_candcxx(self, value):
|
||||
"""
|
||||
Add flag or list of flags to CFLAGS and CXXFLAGS
|
||||
:param value: string or list of strings
|
||||
"""
|
||||
self.add_c(value)
|
||||
self.add_cxx(value)
|
||||
|
||||
def add_link(self, value):
|
||||
"""
|
||||
Add flag or list of flags to LINKFLAGS
|
||||
:param value: string or list of strings
|
||||
"""
|
||||
self.add('LINKFLAGS', value)
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_cxx')
|
||||
conf.load('compiler_c')
|
||||
|
|
Loading…
Reference in New Issue