2 # liboctbstack (share library) build script
8 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
10 liboctbstack_env = lib_env.Clone()
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'))
19 ######################################################################
21 ######################################################################
22 liboctbstack_env.PrependUnique(CPPPATH = [
23 '../../extlibs/cjson/',
31 'stack/include/internal',
32 '../oc_logger/include',
37 if target_os not in ['arduino', 'windows', 'winrt']:
38 liboctbstack_env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
39 liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99'])
41 if target_os not in ['windows', 'winrt']:
42 liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
44 if target_os == 'android':
45 liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
46 liboctbstack_env.AppendUnique(LIBS = ['coap', 'm'])
48 if target_os == 'arduino':
49 liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
51 liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC'])
53 if target_os in ['darwin', 'ios']:
54 liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
55 liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
56 liboctbstack_env.AppendUnique(LIBS = ['coap'])
58 if not env.get('RELEASE'):
59 liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
61 liboctbstack_env.AppendUnique(CPPDEFINES = ['CA_INT'])
63 ######################################################################
64 # Source files and Targets
65 ######################################################################
66 OCTBSTACK_SRC = 'stack/src/'
68 '../../extlibs/cjson/cJSON.c',
69 'occoap/src/occoap.c',
70 'occoap/src/occoaphelper.c',
71 OCTBSTACK_SRC + 'ocstack.c',
72 OCTBSTACK_SRC + 'occlientcb.c',
73 OCTBSTACK_SRC + 'ocresource.c',
74 OCTBSTACK_SRC + 'ocobserve.c',
75 OCTBSTACK_SRC + 'ocserverrequest.c',
76 OCTBSTACK_SRC + 'occollection.c',
77 OCTBSTACK_SRC + 'ocsecurity.c',
78 OCTBSTACK_SRC + 'oicgroup.c'
80 if target_os == 'arduino':
81 liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
83 liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
85 liboctbstack_env.InstallTarget(liboctbstack, 'liboctbstack')