aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-08-04 23:37:58 +0200
committerDavid Robillard <d@drobilla.net>2020-03-11 20:32:58 +0100
commit315b1a784d270c9f3ca0d430c3c1802a3ebfd918 (patch)
treed5757ecf31b3287a66e2ad53cca07c1c4f6c5f15 /wscript
parent5c02f37c8d1dd74f3b72f1fb0b2a77f4d1dc2da9 (diff)
downloadpugl-315b1a784d270c9f3ca0d430c3c1802a3ebfd918.tar.gz
pugl-315b1a784d270c9f3ca0d430c3c1802a3ebfd918.tar.bz2
pugl-315b1a784d270c9f3ca0d430c3c1802a3ebfd918.zip
WIP: Update C++ bindingsc++
Diffstat (limited to 'wscript')
-rw-r--r--wscript31
1 files changed, 24 insertions, 7 deletions
diff --git a/wscript b/wscript
index 510b260..7445e01 100644
--- a/wscript
+++ b/wscript
@@ -22,6 +22,7 @@ out = 'build' # Build directory
def options(ctx):
ctx.load('compiler_c')
+ ctx.load('compiler_cxx')
opts = ctx.configuration_options()
opts.add_option('--target', default=None, dest='target',
@@ -43,24 +44,34 @@ def options(ctx):
def configure(conf):
conf.load('compiler_c', cache=True)
+ try:
+ conf.load('compiler_cxx', cache=True)
+ except Exception:
+ pass
+
conf.load('autowaf', cache=True)
autowaf.set_c_lang(conf, 'c99')
+ if 'COMPILER_CXX' in conf.env:
+ autowaf.set_cxx_lang(conf, 'c++11')
conf.env.ALL_HEADERS = Options.options.all_headers
conf.env.TARGET_PLATFORM = Options.options.target or sys.platform
platform = conf.env.TARGET_PLATFORM
+ def append_cflags(flags):
+ conf.env.append_value('CFLAGS', flags)
+ conf.env.append_value('CXXFLAGS', flags)
+
if platform == 'darwin':
- conf.env.append_unique('CFLAGS', ['-Wno-deprecated-declarations'])
+ append_cflags(['-Wno-deprecated-declarations'])
if conf.env.MSVC_COMPILER:
- conf.env.append_unique('CFLAGS', ['/wd4191'])
+ append_cflags(['/wd4191'])
else:
- conf.env.append_value('LINKFLAGS', ['-fvisibility=hidden'])
- conf.env.append_value('CFLAGS', ['-fvisibility=hidden'])
+ conf.env.append_unique('LINKFLAGS', ['-fvisibility=hidden'])
+ append_cflags(['-fvisibility=hidden'])
if Options.options.strict:
- conf.env.append_value('CFLAGS', ['-Wunused-parameter',
- '-Wno-pedantic'])
+ append_cflags(['-Wunused-parameter', '-Wno-pedantic'])
if Options.options.ultra_strict and 'clang' in conf.env.CC:
for var in ['CFLAGS', 'CXXFLAGS']:
@@ -289,6 +300,8 @@ def build(bld):
source=['pugl/detail/x11_cairo.c'])
def build_example(prog, source, platform, backend, **kwargs):
+ lang = 'cxx' if source[0].endswith('.cpp') else 'c'
+
use = ['pugl_%s_static' % platform,
'pugl_%s_%s_static' % (platform, backend)]
@@ -308,7 +321,7 @@ def build(bld):
deps.get(platform, {}).get(k, []) +
deps.get(backend_lib, {}).get(k, []))})
- bld(features = 'c cprogram',
+ bld(features = '%s %sprogram' % (lang, lang),
source = source,
target = target,
use = use,
@@ -349,6 +362,10 @@ def build(bld):
'pugl_%s_stub_static' % platform],
uselib = deps[platform]['uselib'] + ['CAIRO'])
+ if bld.env.CXX and bld.env.HAVE_GL:
+ build_example('pugl_cxx_demo', ['examples/pugl_cxx_demo.cpp'],
+ platform, 'gl', uselib=['GL', 'M'])
+
if bld.env.DOCS:
autowaf.build_dox(bld, 'PUGL', PUGL_VERSION, top, out)