-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSConscript
More file actions
144 lines (124 loc) · 5.66 KB
/
SConscript
File metadata and controls
144 lines (124 loc) · 5.66 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Copyright 2010 - 2013 Qualcomm Innovation Center, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
Import('env')
from os.path import basename
#default crypto for most platforms is openssl
env['CRYPTO'] = 'openssl'
# Bullseye code coverage for 'debug' builds.
if env['VARIANT'] == 'debug':
if(not(env.has_key('BULLSEYE_BIN'))):
print('BULLSEYE_BIN not specified')
else:
env.PrependENVPath('PATH', env.get('BULLSEYE_BIN'))
if (not(os.environ.has_key('COVFILE'))):
print('Error: COVFILE environment variable must be set')
if not GetOption('help'):
Exit()
else:
env.PrependENVPath('COVFILE', os.environ['COVFILE'])
# Make alljoyn C++ dist a sub-directory of the alljoyn dist.
env['CPP_DISTDIR'] = env['DISTDIR'] + '/cpp'
env['CPP_TESTDIR'] = env['TESTDIR'] + '/cpp'
# Platform specifics for common
if env['OS_GROUP'] == 'windows':
vars = Variables()
vars.Add(PathVariable('OPENSSL_BASE', 'Base OpenSSL directory (windows only)', os.environ.get('OPENSSL_BASE')))
vars.Update(env)
Help(vars.GenerateHelpText(env))
env.AppendUnique(LIBS = ['setupapi', 'user32', 'winmm', 'ws2_32', 'iphlpapi', 'secur32', 'Advapi32'])
# Key of presence of OPENSSL_BASE to decide if to use openssl or window CNG crypto
if '' == env.subst('$OPENSSL_BASE'):
if env['OS'] == 'winxp':
# Must specify OPENSSL_BASE for winXP
print 'Must specify OPENSSL_BASE when building for WindowsXP'
if not GetOption('help'):
Exit()
else:
env.AppendUnique(LIBS = ['bcrypt', 'ncrypt', 'crypt32'])
env['CRYPTO'] = 'cng'
print 'Using CNG crypto libraries'
else:
env.Append(CPPPATH = ['$OPENSSL_BASE/include'])
env.Append(LIBPATH = ['$OPENSSL_BASE/lib'])
env.AppendUnique(LIBS = ['libeay32', 'ssleay32'])
print 'Using OPENSSL crypto libraries'
elif env['OS_GROUP'] == 'winrt':
env['CRYPTO'] = 'winrt'
print 'Using WINRT crypto libraries'
env.AppendUnique(CFLAGS=['/D_WINRT_DLL'])
env.AppendUnique(CXXFLAGS=['/D_WINRT_DLL'])
elif env['OS'] == 'linux' or env['OS'] == 'openwrt':
env.AppendUnique(LIBS =['rt', 'stdc++', 'pthread', 'crypto', 'ssl'])
elif env['OS'] == 'darwin':
env.AppendUnique(LIBS =['stdc++', 'pthread', 'crypto', 'ssl'])
if env['CPU'] == 'arm' or env['CPU'] == 'armv7' or env['CPU'] == 'armv7s':
vars = Variables()
vars.Add(PathVariable('OPENSSL_ROOT', 'Base OpenSSL directory (darwin only)', os.environ.get('OPENSSL_ROOT')))
vars.Update(env)
Help(vars.GenerateHelpText(env))
if '' == env.subst('$OPENSSL_ROOT'):
# Must specify OPENSSL_ROOT for darwin, arm
print 'Must specify OPENSSL_ROOT when building for OS=darwin, CPU=arm'
if not GetOption('help'):
Exit()
env.Append(CPPPATH = ['$OPENSSL_ROOT/include'])
env.Append(LIBPATH = ['$OPENSSL_ROOT/build/' + os.environ.get('CONFIGURATION') + '-' + os.environ.get('PLATFORM_NAME')])
elif env['OS'] == 'android':
env.AppendUnique(LIBS = ['m', 'c', 'stdc++', 'crypto', 'log', 'gcc', 'ssl'])
if (env.subst('$ANDROID_NDK_VERSION') == '7' or
env.subst('$ANDROID_NDK_VERSION') == '8' or
env.subst('$ANDROID_NDK_VERSION') == '8b' or
env.subst('$ANDROID_NDK_VERSION') == '8c' or
env.subst('$ANDROID_NDK_VERSION') == '8d'):
env.AppendUnique(LIBS = ['gnustl_static'])
elif env['OS'] == 'maemo':
pass
else:
print 'Unrecognized OS in common: ' + env.subst('$OS')
if not GetOption('help'):
Exit()
env.AppendUnique(CPPDEFINES = ['QCC_OS_GROUP_%s' % env['OS_GROUP'].upper()])
# Variant settings
env.VariantDir('$OBJDIR', 'src', duplicate = 0)
env.VariantDir('$OBJDIR/os', 'os/${OS_GROUP}', duplicate = 0)
env.VariantDir('$OBJDIR/crypto', 'crypto/${CRYPTO}', duplicate = 0)
# Setup dependent include directories
if env['OS_GROUP'] == 'winrt':
hdrs = {}
else:
hdrs = { 'qcc': env.File(['inc/qcc/Log.h',
'inc/qcc/ManagedObj.h',
'inc/qcc/String.h',
'inc/qcc/atomic.h',
'inc/qcc/platform.h']),
'qcc/${OS_GROUP}': env.File(['inc/qcc/${OS_GROUP}/atomic.h',
'inc/qcc/${OS_GROUP}/platform_types.h']) }
if env['OS_GROUP'] == 'windows' or env['OS_GROUP'] == 'win8':
hdrs['qcc/${OS_GROUP}'] += env.File(['inc/qcc/${OS_GROUP}/mapping.h'])
env.Append(CPPPATH = [env.Dir('inc')])
# Build the sources
status_cpp0x_src = ['Status_CPP0x.cc', 'StatusComment.cc']
status_src = ['Status.cc']
srcs = env.Glob('$OBJDIR/*.cc') + env.Glob('$OBJDIR/os/*.cc') + env.Glob('$OBJDIR/crypto/*.cc')
if env['OS_GROUP'] == 'winrt':
srcs = [ f for f in srcs if basename(str(f)) not in status_cpp0x_src ]
# Make sure Status never gets included from common for contained projects
srcs = [ f for f in srcs if basename(str(f)) not in status_src ]
objs = env.Object(srcs)
# Build unit Tests
env.SConscript('unit_test/SConscript', variant_dir='$OBJDIR/unittest', duplicate=0)
ret = (hdrs, objs)
Return('ret')