Merge "Add missing enum value of OCStackResult to switch in reason() function of...
[platform/upstream/iotivity.git] / resource / csdk / SConscript
1 ##
2 # liboctbstack (share library) build script
3 ##
4
5 Import('env')
6
7 lib_env = env.Clone()
8 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
9
10 liboctbstack_env = lib_env.Clone()
11
12 target_os = env.get('TARGET_OS')
13 # As in the source code, it includes arduino Time library (C++)
14 # It requires compile the .c with g++
15 if target_os == 'arduino':
16         liboctbstack_env.Replace(CC = env.get('CXX'))
17         liboctbstack_env.Replace(CFLAGS = env.get('CXXFLAGS'))
18
19 ######################################################################
20 # Build flags
21 ######################################################################
22 liboctbstack_env.PrependUnique(CPPPATH = [
23                 '../../extlibs/cjson/',
24                 'ocsocket/include',
25                 'logger/include',
26                 'ocrandom/include',
27                 'ocmalloc/include',
28                 'libcoap',
29                 'occoap/include',
30                 'stack/include',
31                 'stack/include/internal',
32                 '../oc_logger/include'
33                 ])
34
35 if target_os not in ['arduino', 'windows', 'winrt']:
36         liboctbstack_env.AppendUnique(CPPDEFINES  = ['WITH_POSIX'])
37         liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99'])
38
39 if target_os not in ['windows', 'winrt']:
40         liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
41
42 liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
43 liboctbstack_env.AppendUnique(LIBS = ['coap', 'm'])
44
45 if target_os == 'arduino':
46         liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
47 else:
48         liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC'])
49
50 if target_os in ['darwin', 'ios']:
51         liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
52
53 if not env.get('RELEASE'):
54         liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
55
56 ######################################################################
57 # Source files and Targets
58 ######################################################################
59 OCTBSTACK_SRC = 'stack/src/'
60 liboctbstack_src = [
61         '../../extlibs/cjson/cJSON.c',
62         'occoap/src/occoap.c',
63         'occoap/src/occoaphelper.c',
64         OCTBSTACK_SRC + 'ocstack.c',
65         OCTBSTACK_SRC + 'occlientcb.c',
66         OCTBSTACK_SRC + 'ocresource.c',
67         OCTBSTACK_SRC + 'ocobserve.c',
68     OCTBSTACK_SRC + 'ocserverrequest.c',
69         OCTBSTACK_SRC + 'occollection.c',
70         OCTBSTACK_SRC + 'ocsecurity.c',
71     OCTBSTACK_SRC + 'oicgroup.c'
72         ]
73 if target_os == 'arduino':
74         static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
75         liboctbstack_env.InstallTarget(static_liboctbstack, 'liboctbstack')
76 else:
77         static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
78         shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
79         liboctbstack_env.InstallTarget([static_liboctbstack, shared_liboctbstack], 'liboctbstack')
80
81