Files
unison/src/config-store/wscript
Tommaso Pecorella 3f8a2afdc8 build: partially rev. a455a427 (-Wno-parentheses)
This fixes #339. "-Wno-parentheses" is still needed by GTK+3.22
2021-01-20 20:26:37 +00:00

97 lines
3.7 KiB
Python

## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import wutils
import sys
import subprocess
from waflib import Options
# Bug 2936 gcc version issue for GTK+ and -Wparentheses
gcc_version_gtkplus_warning_issue = (8, 0, 0)
def options(opt):
opt.add_option('--disable-gtk',
help=('Disable GTK+ support'),
dest='disable_gtk', default=False, action="store_true")
def configure(conf):
if Options.options.disable_gtk:
conf.env['ENABLE_GTK'] = False
conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
conf.env['ENABLE_GTK'],
"--disable-gtk option given")
else:
have_gtk = conf.check_cfg(package='gtk+-3.0 >= 3.22',
args=['--cflags', '--libs'], uselib_store='GTK',
mandatory=False)
conf.env['ENABLE_GTK'] = have_gtk
conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
conf.env['ENABLE_GTK'],
"library 'gtk+-3 >= 3.22' not found")
# Bug 2936 and #340 -Wparentheses issue for gcc >= 8
# This have to be kept until we can bump the minimum GTK version to 3.24
if conf.env['ENABLE_GTK']:
if conf.env['CXX_NAME'] in ['gcc']:
if tuple(map(int, conf.env['CC_VERSION'])) >= gcc_version_gtkplus_warning_issue:
conf.env.append_value('CXXFLAGS', '-Wno-parentheses')
have_libxml2 = conf.check_cfg(package='libxml-2.0 >= 2.7',
args=['--cflags', '--libs'], uselib_store='LIBXML2',
mandatory=False)
conf.env['ENABLE_LIBXML2'] = have_libxml2
conf.report_optional_feature("XmlIo", "XmlIo",
conf.env['ENABLE_LIBXML2'],
"library 'libxml-2.0 >= 2.7' not found")
conf.write_config_header('ns3/config-store-config.h', top=True)
def build(bld):
bld.install_files('${INCLUDEDIR}/%s%s/ns3' % (wutils.APPNAME, wutils.VERSION), '../../ns3/config-store-config.h')
module = bld.create_ns3_module('config-store', ['core', 'network'])
module.source = [
'model/attribute-iterator.cc',
'model/config-store.cc',
'model/attribute-default-iterator.cc',
'model/file-config.cc',
'model/raw-text-config.cc',
]
headers = bld(features='ns3header')
headers.module = 'config-store'
headers.source = [
'model/file-config.h',
'model/config-store.h',
]
if bld.env['ENABLE_GTK']:
headers.source.append('model/gtk-config-store.h')
module.source.extend(['model/gtk-config-store.cc',
'model/model-node-creator.cc',
'model/model-typeid-creator.cc',
'model/display-functions.cc',
])
module.use.append('GTK')
if bld.env['ENABLE_LIBXML2']:
module.source.append('model/xml-config.cc')
module.use.append('LIBXML2')
# Bug 2637: use xcrun utility to find where macOS puts headers
if sys.platform == 'darwin':
find_sdk_path = '/usr/bin/xcrun --show-sdk-path'.split()
try:
p = subprocess.Popen(find_sdk_path, stdout=subprocess.PIPE)
xcrun_output = p.stdout.read().strip().decode("utf-8")
module.includes = str(xcrun_output + u'/usr/include/libxml2')
except OSError:
pass
if bld.env['ENABLE_EXAMPLES']:
bld.recurse('examples')
bld.ns3_python_bindings()