File: SConscript

package info (click to toggle)
alljoyn-core-1509 15.09a-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 31,280 kB
  • sloc: cpp: 221,760; java: 40,806; objc: 17,659; ansic: 5,152; xml: 4,203; cs: 3,417; python: 1,775; sh: 1,139; makefile: 210; perl: 72
file content (99 lines) | stat: -rw-r--r-- 4,311 bytes parent folder | download | duplicates (6)
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
# 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 os
import sys

Import('env')

# Dependent Projects
if not env.has_key('_ALLJOYNCORE_'):
    env.SConscript('../alljoyn_core/SConscript')

# Indicate that this SConscript file has been loaded already
env['_ALLJOYNC_'] = True

clibenv = env.Clone()

vars = Variables();
vars.Update(clibenv)
Help(vars.GenerateHelpText(clibenv))


# C binding requires a couple of header files in alljoyn_core/src
clibenv.Append(CPPPATH = [clibenv.Dir('../alljoyn_core/src').srcnode()])

sys.path.append(str(clibenv.Dir('../build_core/tools/scons').srcnode()))

# Make alljoyn C dist a sub-directory of the alljoyn dist.
clibenv['C_DISTDIR'] = clibenv['DISTDIR'] + '/c'
clibenv['C_TESTDIR'] = clibenv['TESTDIR'] + '/c'

clibenv['OBJDIR_ALLJOYN_C'] = clibenv['OBJDIR'] + '/alljoyn_c'

# Add support for multiple build targets in the same workset
clibenv.VariantDir('$OBJDIR_ALLJOYN_C', 'src', duplicate = 0)
clibenv.VariantDir('$OBJDIR_ALLJOYN_C/samples', 'samples', duplicate = 0)

# Install headers
# C bindings use the following headers from alljoyn_core
alljoyn_core_headers = clibenv.Install('inc/alljoyn_c', '$DISTDIR/cpp/inc/alljoyn/DBusStdDefines.h')
alljoyn_core_headers += clibenv.Install('inc/alljoyn_c', '$DISTDIR/cpp/inc/alljoyn/Status.h')
alljoyn_core_headers += clibenv.Install('inc/qcc/${OS_GROUP}', '$DISTDIR/cpp/inc/qcc/${OS_GROUP}/platform_types.h')

if clibenv['OS_GROUP'] == 'windows':
    alljoyn_core_headers += clibenv.Install('inc/qcc/${OS_GROUP}', '$DISTDIR/cpp/inc/qcc/${OS_GROUP}/mapping.h')

c_headers = clibenv.Install('$C_DISTDIR/inc/alljoyn_c', clibenv.Glob('inc/alljoyn_c/*.h'))
c_headers += clibenv.Install('$C_DISTDIR/inc/qcc', clibenv.Glob('inc/qcc/*.h'))
c_headers += clibenv.Install('$C_DISTDIR/inc/qcc/${OS_GROUP}', clibenv.Glob('inc/qcc/${OS_GROUP}/*.h'))

# make sure the headers from alljoyn_core have been copied into the alljoyn_c headers 
clibenv.Depends(c_headers, alljoyn_core_headers)

# AllJoyn Libraries, and shared object files.
static_lib, shared_lib, env['AJ_C_OBJS'] = clibenv.SConscript('$OBJDIR_ALLJOYN_C/SConscript', exports = {'env':clibenv})
libs = [static_lib, shared_lib]
dlibs = clibenv.Install('$C_DISTDIR/lib', libs)

# the variable dlibs contains the file nodes for the  static library and the 
# shared library however it may contain more files such as .pdb files on windows.  
# Search through the list and assign the static library to the ALLJOYN_C_LIB_STATIC 
# clibenv variable and the shared library to ALLJOYN_C_LIB_SHARED clibenv variable.
for x in dlibs: 
    if clibenv['OS_GROUP'] == 'windows':
        if 'alljoyn_c_static' + clibenv['LIBSUFFIX'] in str(x):
            clibenv['ALLJOYN_C_LIB_STATIC'] = x;
    else:
        if 'alljoyn_c' + clibenv['LIBSUFFIX'] in str(x):
            clibenv['ALLJOYN_C_LIB_STATIC'] = x;
    if 'alljoyn_c' + clibenv['SHLIBSUFFIX'] in str(x):
        clibenv['ALLJOYN_C_LIB_SHARED'] = x;

# Build docs
c_docs = clibenv.SConscript('docs/SConscript', exports = {'env':clibenv})
clibenv.Depends(c_docs, c_headers)

# Sample programs
clibenv.SConscript('$OBJDIR_ALLJOYN_C/samples/SConscript', exports = {'env':clibenv})

# Test programs
clibenv.SConscript('test/SConscript', variant_dir='$OBJDIR_ALLJOYN_C/test', duplicate=0, exports = {'env':clibenv})

# Build unit Tests
clibenv.SConscript('unit_test/SConscript', variant_dir='$OBJDIR_ALLJOYN_C/unittest', duplicate=0, exports = {'env':clibenv})

# don't try and build the samples till the header files are copied into place
#clibenv.Depends(dlibs, c_headers)