Validate device state for RFNOP
[platform/upstream/iotivity.git] / service / coap-http-proxy / SConscript
1 #******************************************************************
2 #
3 # Copyright 2016 Samsung Electronics All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
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
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 ##
22 # CoAP-HTTP Proxy build script
23 ##
24 Import('env')
25 import os
26 local_env = env.Clone()
27
28 if local_env.get('LOGGING'):
29     local_env.AppendUnique(CPPDEFINES = ['-DTB_LOG'])
30
31 if env.get('RELEASE'):
32     env.AppendUnique(CCFLAGS = ['-Os'])
33     env.AppendUnique(CPPDEFINES = ['NDEBUG'])
34 else:
35     env.AppendUnique(CCFLAGS = ['-g'])
36
37 target_os = env.get('TARGET_OS')
38 src_dir = env.get('SRC_DIR')
39
40 ######################################################################
41 # Build flags
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'),
48                 ])
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'])
52
53 if target_os in ['linux', 'tizen']:
54     local_env.AppendUnique(LIBS = ['pthread', 'curl'])
55
56 if target_os == 'android':
57     local_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
58     local_env.AppendUnique(LIBS = ['gnustl_static'])
59
60     if not env.get('RELEASE'):
61         rd_env.AppendUnique(LIBS = ['log'])
62 ######################################################################
63 # Source files and Targets
64 ######################################################################
65
66 proxy_src = [
67         './src/CoapHttpHandler.c',
68         './src/CoapHttpMap.c',
69         './src/CoapHttpParser.c',
70 ]
71
72 if target_os in ['tizen'] :
73     proxysdk = local_env.SharedLibrary('coap_http_proxy', proxy_src)
74 else :
75     proxysdk = local_env.StaticLibrary('coap_http_proxy', proxy_src)
76
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')
80
81
82 ######################################################################
83 # Samples for the proxy
84 ######################################################################
85 if target_os in ['linux', 'tizen']:
86     SConscript('samples/SConscript')
87
88 if target_os in ['linux']:
89     SConscript('unittests/SConscript')