aboutsummaryrefslogtreecommitdiffstats
path: root/alljoyn_core/router/SConscript
blob: c149fe004988856185439b19970dba9dc2be6ba5 (plain)
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
#    Copyright (c) Open Connectivity Foundation (OCF), AllJoyn Open Source
#    Project (AJOSP) Contributors and others.
#
#    SPDX-License-Identifier: Apache-2.0
#
#    All rights reserved. This program and the accompanying materials are
#    made available under the terms of the Apache License, Version 2.0
#    which accompanies this distribution, and is available at
#    http://www.apache.org/licenses/LICENSE-2.0
#
#    Copyright (c) Open Connectivity Foundation and Contributors to 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.

from os.path import basename

Import('env')

router_env = env.Clone()

vars = Variables()
vars.Add(EnumVariable('POLICYDB', 'Enable policy support', 'off', allowed_values=('on', 'off')))
vars.Add('TEST_CONFIG', 'The bundled router will attempt to use the specified file as its config file (if present at runtime).')
vars.Update(router_env)
Help(vars.GenerateHelpText(router_env))


if router_env['OS_SUBGROUP'] == "darwin":
    # Darwin has its own version of the daemon transport
	srcs = [ f for f in router_env.Glob('*.cc') + router_env.Glob('*.c') + [router_env['OS_SUBGROUP'] + '/DaemonTransport' + router_env['OS_SUBGROUP'].capitalize() + '.cc'] ]
else:
	srcs = [ f for f in router_env.Glob('*.cc') + router_env.Glob('*.c') + [router_env['OS_GROUP'] + '/DaemonTransport' + router_env['OS_GROUP'].capitalize() + '.cc']]

srcs += [router_env['OS_GROUP'] + '/Socket.cc']

if router_env['OS'] != "android":
    srcs += [router_env['OS_GROUP'] + '/PermissionMgr' + router_env['OS_GROUP'].capitalize() + '.cc']

router_env.Append(CPPPATH = [ router_env.Dir('..').srcnode(),
                              router_env.Dir('.').srcnode(),
                              router_env.Dir('$OS_GROUP').srcnode() ])

if 'TEST_CONFIG' in router_env and router_env['BR'] == "on":
    router_env.Append(CPPDEFINES = {'TEST_CONFIG' : '\\\"${TEST_CONFIG}\\\"'})

if router_env['POLICYDB'] == 'on':
    router_env.Append(CPPDEFINES = [ 'ENABLE_POLICYDB' ])
    router_env.Append(CPPPATH = [ router_env.Dir('policydb').srcnode() ])
    srcs += [ 'policydb/PolicyDB.cc' ]

router_objs = router_env.Object(srcs)

router_objs.extend(router_env.SConscript('ns/SConscript', exports = ['router_env']))

if router_env['OS'] == "android":
    router_objs.extend(router_env.SConscript('android/SConscript', exports = ['router_env']))

# Standalone daemon object file
srobj = router_env.SConscript('standalone/SConscript', exports = ['router_env'])

# Bundled daemon object file
brobj = router_env.SConscript('bundled/SConscript', exports = ['router_env'])

progs = router_env.SConscript('${OS_GROUP}/SConscript', exports=['router_env', 'router_objs', 'srobj'])

# Bundled daemon library
lib = router_env.StaticLibrary('ajrouter', brobj + router_objs);

# AllJoyn Daemon test programs
if router_env['OS'] == 'darwin':
    if router_env['CPU'] in ['arm', 'armv7', 'armv7s', 'arm64'] or router_env['OS'] == 'iOS':
        print 'Not building unit tests for iOS...'
        tests = []
    else:
        print 'Building unit tests for darwin...'
        tests = router_env.SConscript('test/SConscript', exports = ['router_env', 'router_objs', 'srobj'])
else:
    tests = router_env.SConscript('test/SConscript', exports = ['router_env', 'router_objs', 'srobj'])

# Return daemon and related tests
ret = progs + tests, lib, srobj, router_objs
Return('ret')