2 # liboctbstack (share library) build script
6 liboctbstack_env = env.Clone()
8 target_os = env.get('TARGET_OS')
9 # As in the source code, it includes arduino Time library (C++)
10 # It requires compile the .c with g++
11 if target_os == 'arduino':
12 liboctbstack_env.Replace(CC = env.get('CXX'))
13 liboctbstack_env.Replace(CFLAGS = env.get('CXXFLAGS'))
15 ######################################################################
17 ######################################################################
18 liboctbstack_env.PrependUnique(CPPPATH = [
19 '../../extlibs/cjson/',
20 '../../extlibs/timer/',
28 'stack/include/internal',
29 '../oc_logger/include'
32 if target_os not in ['arduino', 'windows', 'winrt']:
33 liboctbstack_env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
34 liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99'])
36 if target_os not in ['windows', 'winrt']:
37 liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
39 liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
40 liboctbstack_env.AppendUnique(LIBS = ['coap', 'm'])
42 if target_os == 'arduino':
43 liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
45 if target_os in ['darwin', 'ios']:
46 liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
48 if not env.get('RELEASE'):
49 liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
51 ######################################################################
52 # Source files and Targets
53 ######################################################################
54 OCTBSTACK_SRC = 'stack/src/'
56 '../../extlibs/cjson/cJSON.c',
57 '../../extlibs/timer/timer.c',
58 'occoap/src/occoap.c',
59 'occoap/src/occoaphelper.c',
60 OCTBSTACK_SRC + 'ocstack.c',
61 OCTBSTACK_SRC + 'occlientcb.c',
62 OCTBSTACK_SRC + 'ocresource.c',
63 OCTBSTACK_SRC + 'ocobserve.c',
64 OCTBSTACK_SRC + 'ocserverrequest.c',
65 OCTBSTACK_SRC + 'occollection.c',
66 OCTBSTACK_SRC + 'ocsecurity.c',
67 OCTBSTACK_SRC + 'oicgroup.c'
69 if target_os == 'arduino':
70 static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
71 liboctbstack_env.InstallTarget(static_liboctbstack, 'liboctbstack')
73 static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
74 shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
75 liboctbstack_env.InstallTarget([static_liboctbstack, shared_liboctbstack], 'liboctbstack')