1 #******************************************************************
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # liboctbstack (share library) build script
27 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
29 liboctbstack_env = lib_env.Clone()
31 target_os = env.get('TARGET_OS')
32 # As in the source code, it includes arduino Time library (C++)
33 # It requires compile the .c with g++
34 if target_os == 'arduino':
35 liboctbstack_env.Replace(CC = env.get('CXX'))
36 liboctbstack_env.Replace(CFLAGS = env.get('CXXFLAGS'))
38 ######################################################################
40 ######################################################################
41 liboctbstack_env.PrependUnique(CPPPATH = [
42 '../../extlibs/cjson/',
43 '../../extlibs/timer/',
48 'stack/include/internal',
49 '../oc_logger/include',
50 'connectivity/lib/libcoap-4.1.1',
54 'security/include/internal',
57 if target_os not in ['arduino', 'windows', 'winrt']:
58 liboctbstack_env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
59 liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99'])
61 if target_os not in ['windows', 'winrt']:
62 liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
64 liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
65 liboctbstack_env.AppendUnique(LIBS = ['coap', 'm'])
67 if target_os not in ['android', 'arduino', 'windows', 'winrt']:
68 liboctbstack_env.AppendUnique(LIBS = ['pthread'])
70 if target_os == 'arduino':
71 liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
72 elif target_os not in ['darwin','ios']:
73 liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC'])
74 if target_os == 'android':
75 liboctbstack_env.AppendUnique(LIBS = ['connectivity_abstraction'])
76 if target_os in ['darwin', 'ios']:
77 liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
78 liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
79 liboctbstack_env.AppendUnique(LIBS = ['coap'])
81 if env.get('LOGGING'):
82 liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
84 ######################################################################
85 # Source files and Targets
86 ######################################################################
87 OCTBSTACK_SRC = 'stack/src/'
89 '../../extlibs/cjson/cJSON.c',
90 '../../extlibs/timer/timer.c',
91 OCTBSTACK_SRC + 'ocstack.c',
92 OCTBSTACK_SRC + 'occlientcb.c',
93 OCTBSTACK_SRC + 'ocresource.c',
94 OCTBSTACK_SRC + 'ocobserve.c',
95 OCTBSTACK_SRC + 'ocserverrequest.c',
96 OCTBSTACK_SRC + 'occollection.c',
97 OCTBSTACK_SRC + 'oicgroup.c',
98 'security/src/ocsecurity.c',
99 'logger/src/logger.c',
100 'ocrandom/src/ocrandom.c',
101 'ocmalloc/src/ocmalloc.c'
103 if target_os in ['arduino','darwin','ios'] :
104 static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
105 liboctbstack_env.InstallTarget(static_liboctbstack, 'liboctbstack')
107 static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
108 shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
109 liboctbstack_env.InstallTarget([static_liboctbstack, shared_liboctbstack], 'liboctbstack')