diff options
Diffstat (limited to 'wscript')
-rw-r--r-- | wscript | 53 |
1 files changed, 50 insertions, 3 deletions
@@ -28,10 +28,12 @@ post_tags = ['Hacking', 'RDF', 'Serd'] def options(ctx): ctx.load('compiler_c') + ctx.load('compiler_cxx') opt = ctx.configuration_options() ctx.add_flags( opt, {'no-utils': 'do not build command line utilities', + 'no-cxx': 'do not build C++ bindings', 'stack-check': 'include runtime stack sanity checks', 'static': 'build static library', 'no-shared': 'do not build shared library', @@ -43,11 +45,18 @@ def options(ctx): def configure(conf): conf.load('compiler_c', cache=True) + + if not Options.options.no_cxx: + conf.load('compiler_cxx', cache=True) + conf.load('autowaf', cache=True) if not autowaf.set_c_lang(conf, 'c11', mandatory=False): autowaf.set_c_lang(conf, 'c99') + if 'COMPILER_CXX' in conf.env: + autowaf.set_cxx_lang(conf, 'c++11') + if Options.options.strict: # Check for programs used by lint target conf.find_program("flake8", var="FLAKE8", mandatory=False) @@ -94,6 +103,26 @@ def configure(conf): ], }) + autowaf.add_compiler_flags(conf.env, 'cxx', { + 'clang': [ + '-Wno-documentation-unknown-command', + ], + 'gcc': [ + '-Wno-multiple-inheritance', + ], + 'msvc': [ + '/wd4355', # 'this' used in base member initializer list + '/wd4571', # structured exceptions are no longer caught + '/wd4623', # default constructor implicitly deleted + '/wd4625', # copy constructor implicitly deleted + '/wd4626', # assignment operator implicitly deleted + '/wd4710', # function not inlined + '/wd4868', # may not enforce left-to-right evaluation order + '/wd5026', # move constructor implicitly deleted + '/wd5027', # move assignment operator implicitly deleted + ] + }) + conf.env.update({ 'BUILD_UTILS': not Options.options.no_utils, 'BUILD_SHARED': not Options.options.no_shared, @@ -198,9 +227,14 @@ lib_source = ['src/base64.c', def build(bld): - # C Headers + # Main C and C++ headers includedir = '${INCLUDEDIR}/serd-%s/serd' % SERD_MAJOR_VERSION - bld.install_files(includedir, bld.path.ant_glob('serd/*.h')) + bld.install_files(includedir, bld.path.ant_glob('serd/*.h*')) + + # C++ detail headers + includedir = '${INCLUDEDIR}/serd-%s/serd' % SERD_MAJOR_VERSION + bld.install_files(includedir + '/detail', + bld.path.ant_glob('serd/detail/*.hpp')) # Pkgconfig file autowaf.build_pc(bld, 'SERD', SERD_VERSION, SERD_MAJOR_VERSION, [], @@ -243,6 +277,7 @@ def build(bld): coverage_flags = [''] if bld.env.NO_COVERAGE else ['--coverage'] test_args = {'includes': ['.', './src'], 'cflags': coverage_flags, + 'cxxflags': coverage_flags, 'linkflags': coverage_flags, 'lib': lib_args['lib'], 'install_path': ''} @@ -283,6 +318,15 @@ def build(bld): defines = defines, **test_args) + # C++ API test + if 'COMPILER_CXX' in bld.env: + bld(features = 'cxx cxxprogram', + source = 'tests/serd_cxx_test.cpp', + use = 'libserd_profiled', + target = 'serd_cxx_test', + defines = defines, + **test_args) + # Utilities if bld.env.BUILD_UTILS: obj = bld(features = 'c cprogram', @@ -348,7 +392,7 @@ def lint(ctx): if "CLANG_TIDY" in ctx.env and "clang" in ctx.env.CC[0]: Logs.info("Running clang-tidy") - sources = glob.glob('src/*.c') + glob.glob('tests/*.c') + sources = glob.glob('src/*.c') + glob.glob('tests/*.c*') sources = list(map(os.path.abspath, sources)) procs = [] for source in sources: @@ -720,6 +764,9 @@ def test(tst): check(['./statement_test']) check(['./terse_write_test']) + if 'COMPILER_CXX' in tst.env: + check(['./serd_cxx_test']) + def test_syntax_io(check, in_name, check_name, lang): in_path = 'tests/good/%s' % in_name out_path = in_path + '.io' |