File: SConscript

package info (click to toggle)
alljoyn-core-1604 16.04a-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 34,336 kB
  • sloc: cpp: 256,367; java: 42,368; objc: 17,784; ansic: 5,304; xml: 4,714; cs: 3,417; python: 1,777; sh: 1,228; makefile: 210; perl: 72
file content (103 lines) | stat: -rw-r--r-- 3,731 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright AllSeen Alliance. All rights reserved.
#
#    Permission to use, copy, modify, and/or distribute this software for any
#    purpose with or without fee is hereby granted, provided that the above
#    copyright notice and this permission notice appear in all copies.
#
#    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
#    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
#    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
#    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
#    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
#    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
#    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# 

Import('env', 'CheckCXXFlag')
import os

# Linux specific vars
vars = Variables()
vars.Add(BoolVariable('GCOV', 'Compile with gcov support', 'no'))
vars.Add(BoolVariable('ASAN', 'Enable Address Sanitizer runtime checks', 'no'))
vars.Update(env)

Help(vars.GenerateHelpText(env))

config = Configure(env, custom_tests = { 'CheckCXXFlag' : CheckCXXFlag })
if not config.CheckCXXFlag('-std=c++11'):
   if not config.CheckCXXFlag('-std=c++0x'):
      print '*** Compiler too old to build AllJoyn.  Aborting.'
      Exit(1)
env = config.Finish()

# Linux specific flags
env.Append(CPPDEFINES = ['QCC_OS_LINUX'])
env.Append(CPPDEFINES = ['_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC'])

env.Append(CFLAGS = ['-Wall',
                     '-Werror',
                     '-pipe',
                     '-std=c99',
                     '-fno-strict-aliasing',
                     '-fno-asynchronous-unwind-tables',
                     '-fno-unwind-tables',
                     '-ffunction-sections',
                     '-fdata-sections',
                     '-D_FORTIFY_SOURCE=2',
                     '-fPIC',
                     '-Wno-long-long',
                     '-Wunused-parameter'])

env.Append(CXXFLAGS = ['-Wall',
                       '-Werror',
                       '-pipe',
                       '-fno-exceptions',
                       '-fno-strict-aliasing',
                       '-fno-asynchronous-unwind-tables',
                       '-fno-unwind-tables',
                       '-ffunction-sections',
                       '-fdata-sections',
                       '-D_FORTIFY_SOURCE=2',
                       '-fPIC',
                       '-Wno-long-long',
                       '-Wno-deprecated',
                       '-Wno-unknown-pragmas',
                       '-Wunused-parameter'])

env.Append(JAVACFLAGS = ['-Xlint', '-Xlint:-serial'])

env.Append(LINKFLAGS = ['-z', 'relro', '-z', 'now'])

env['SHLIBVERSIONFLAGS'] = " "

# Debug/Release Variants
if env['VARIANT'] == 'debug':
   env.Append(CFLAGS = '-g')
   env.Append(CXXFLAGS = '-g')
   env.Append(JAVACFLAGS = '-g')
   env.Append(CPPDEFINES = ['_GLIBCXX_DEBUG', '_GLIBCXX_DEBUG_PEDANTIC'])
else:
   env.Append(CFLAGS = '-Os')
   env.Append(CXXFLAGS = '-Os')
   env.Append(LINKFLAGS = ['-s', '-Wl,--gc-sections'])

# Code coverage control
if env['GCOV']:
    env.Append(CCFLAGS = ['-fprofile-arcs', '-ftest-coverage'])
    env.Append(LIBS = ['gcov'])

# Address sanitizer control
if env['ASAN']:
   env.Append(CFLAGS = ['-fno-omit-frame-pointer', '-fsanitize=address'])
   env.Append(CXXFLAGS = ['-fno-omit-frame-pointer', '-fsanitize=address'])
   env.Append(LINKFLAGS = '-fsanitize=address')

env.SConscript('${CPU}/SConscript')

env.AppendUnique(LIBS =['rt', 'stdc++', 'pthread', 'm'])
if env['CRYPTO'] == 'openssl':
    env.AppendUnique(LIBS =['crypto', 'ssl'])
    print 'Using OpenSSL crypto'
else:
    print 'Using builtin crypto'