source: rtems-tools/trace/wscript @ 0a5d205

5
Last change on this file since 0a5d205 was 0a5d205, checked in by Christian Mauderer <christian.mauderer@…>, on 06/08/20 at 06:52:10

trace: Use c++14 instead of c++11 if possible

llvm version 10 uses features from c++14 standard in the headers. With
that, the record/record-main-lttng.cc doesn't build any more. This patch
makes sure that c++14 is used if it is available.

Updates #4495

  • Property mode set to 100644
File size: 3.6 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2014-2016 Chris Johns (chrisj@rtems.org)
4# Copyright 2019 embedded brains GmbH
5# All rights reserved.
6#
7# This file is part of the RTEMS Tools package in 'rtems-tools'.
8#
9# Permission to use, copy, modify, and/or distribute this software for any
10# purpose with or without fee is hereby granted, provided that the above
11# copyright notice and this permission notice appear in all copies.
12#
13# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20#
21
22#
23# RTEMS record build script.
24#
25
26def init(ctx):
27    pass
28
29def options(opt):
30    opt.load('compiler_c')
31    opt.load('compiler_cxx')
32
33def configure(conf):
34    conf.load('compiler_c')
35    conf.load('compiler_cxx')
36    try:
37        cppflags = conf.cmd_and_log(['llvm-config', '--cppflags'])
38        ldflags = conf.cmd_and_log(['llvm-config', '--ldflags'])
39        conf.env.append_value('CPPFLAGS', cppflags.split())
40        conf.env.append_value('LDFLAGS', ldflags.split())
41    except:
42        pass
43    if conf.check_cxx(lib = 'LLVM', mandatory=False):
44        conf.check(header_name='llvm/DebugInfo/Symbolize/Symbolize.h', features='cxx', mandatory=False)
45    if conf.check(header_name='zlib.h', features='cxx', mandatory=False):
46        conf.check_cxx(lib = 'z')
47    conf.check_cxx(lib = 'ws2_32', mandatory=False)
48    conf.check_cxx(cxxflags='-std=c++14', mandatory=False, define_name="HAVE_STD_CXX14")
49    conf.write_config_header('config.h')
50
51def build(bld):
52    #
53    # The local configuration.
54    #
55    conf = {}
56
57    #
58    # Build flags.
59    #
60    conf['includes'] = ['.', 'record', 'record/inih']
61    conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic']
62    conf['optflags'] = bld.env.C_OPTS
63    conf['cflags'] = ['-pipe', '-g'] + conf['optflags']
64    cxxstd = '-std=c++11'
65    if bld.env.HAVE_STD_CXX14:
66        cxxstd = '-std=c++14'
67    conf['cxxflags'] = [cxxstd] + conf['cflags']
68    conf['linkflags'] = ['-g']
69    conf['lib'] = []
70    if bld.env.LIB_WS2_32:
71        conf['lib'].extend(bld.env.LIB_WS2_32)
72    if bld.env.LIB_LLVM:
73        conf['lib'].extend(bld.env.LIB_LLVM)
74    if bld.env.LIB_Z:
75        conf['lib'].extend(bld.env.LIB_Z)
76
77    #
78    # The list of defines
79    #
80    defines = ['HAVE_CONFIG_H',
81               'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION),
82               'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)]
83
84    #
85    # Build rtems-record-lttng
86    #
87    bld.program(target = 'rtems-record-lttng',
88                source = ['record/record-client.c',
89                          'record/record-text.c',
90                          'record/record-client-base.cc',
91                          'record/record-filter-base64.cc',
92                          'record/record-filter-zlib.cc',
93                          'record/record-main-lttng.cc',
94                          'record/inih/ini.c'],
95                includes = conf['includes'],
96                defines = defines,
97                cflags = conf['cflags'] + conf['warningflags'],
98                cxxflags = conf['cxxflags'] + conf['warningflags'],
99                linkflags = conf['linkflags'],
100                lib = conf['lib'])
101
102def tags(ctx):
103    ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
Note: See TracBrowser for help on using the repository browser.