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'
35 if target_os not in ['arduino', 'windows', 'winrt']:
36 liboctbstack_env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
37 liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99'])
39 if target_os not in ['windows', 'winrt']:
40 liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
42 liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
43 liboctbstack_env.AppendUnique(LIBS = ['coap', 'm'])
45 if target_os == 'arduino':
46 liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
48 liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC'])
50 if target_os in ['darwin', 'ios']:
51 liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
53 if not env.get('RELEASE'):
54 liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
56 ######################################################################
57 # Source files and Targets
58 ######################################################################
59 OCTBSTACK_SRC = 'stack/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'
73 if target_os == 'arduino':
74 static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
75 liboctbstack_env.InstallTarget(static_liboctbstack, 'liboctbstack')
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')