1 #******************************************************************
3 # Copyright 2016 Samsung Electronics 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 # CoAP-HTTP Proxy build script
26 local_env = env.Clone()
28 if local_env.get('LOGGING'):
29 local_env.AppendUnique(CPPDEFINES = ['-DTB_LOG'])
31 if env.get('RELEASE'):
32 env.AppendUnique(CCFLAGS = ['-Os'])
33 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
35 env.AppendUnique(CCFLAGS = ['-g'])
37 target_os = env.get('TARGET_OS')
38 src_dir = env.get('SRC_DIR')
40 ######################################################################
42 ######################################################################
43 local_env.AppendUnique(CPPPATH = ['include',
44 os.path.join(src_dir, 'resource/csdk/stack/include'),
45 os.path.join(src_dir, 'resource/csdk/connectivity/common/inc/'),
46 os.path.join(src_dir, 'resource/csdk/connectivity/lib/libcoap-4.1.1/include'),
47 os.path.join(src_dir, 'extlibs/cjson'),
49 local_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
50 if target_os not in ['windows']:
51 local_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra'])
53 if target_os in ['linux', 'tizen']:
54 local_env.AppendUnique(LIBS = ['pthread', 'curl'])
56 if target_os == 'android':
57 local_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
58 local_env.AppendUnique(LIBS = ['gnustl_static'])
60 if not env.get('RELEASE'):
61 rd_env.AppendUnique(LIBS = ['log'])
62 ######################################################################
63 # Source files and Targets
64 ######################################################################
67 './src/CoapHttpHandler.c',
68 './src/CoapHttpMap.c',
69 './src/CoapHttpParser.c',
72 if target_os in ['tizen'] :
73 proxysdk = local_env.SharedLibrary('coap_http_proxy', proxy_src)
75 proxysdk = local_env.StaticLibrary('coap_http_proxy', proxy_src)
77 local_env.InstallTarget(proxysdk, 'coap_http_proxy')
78 local_env.UserInstallTargetLib(proxysdk, 'coap_http_proxy')
79 local_env.UserInstallTargetHeader('include/CoapHttpHandler.h', 'service/coap-http-proxy', 'CoapHttpHandler.h')
82 ######################################################################
83 # Samples for the proxy
84 ######################################################################
85 if target_os in ['linux', 'tizen']:
86 SConscript('samples/SConscript')
88 if target_os in ['linux']:
89 SConscript('unittests/SConscript')