Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / plugins / zigbee_wrapper / src / SConscript
1 #******************************************************************
2 #
3 # Copyright 2015 Intel Mobile Communications GmbH 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 # Plugin Interface build script
22 ##
23
24 import os
25 import os.path
26
27 Import('env')
28
29 target_os = env.get('TARGET_OS')
30 src_dir = env.get('SRC_DIR')
31 zw_path = os.path.join(src_dir, 'plugins')
32
33 print"Reading Zigbee Wrapper (ZW) script"
34
35 ######################################################################
36 # Build flags
37 ######################################################################
38
39 env.PrependUnique(CPPPATH = [ os.path.join(src_dir, 'resource', 'c_common', 'oic_malloc', 'include'),
40                               os.path.join(src_dir, 'resource', 'c_common', 'oic_string', 'include'),
41                               os.path.join(src_dir, 'resource', 'oc_logger', 'include'),
42                               os.path.join(src_dir, 'resource', 'csdk', 'logger', 'include'),
43                               os.path.join(src_dir, 'resource', 'csdk', 'stack', 'include'),
44                               ])
45 env.AppendUnique(CPPPATH = [ os.path.join(zw_path, 'include'),
46                              os.path.join(zw_path, 'include', 'internal'),
47                              os.path.join(zw_path, 'zigbee_wrapper', 'include')
48                              ])
49
50 if target_os not in ['arduino', 'windows', 'winrt']:
51         env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
52
53 if target_os in ['darwin','ios']:
54         env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
55
56 env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
57 env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
58 env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
59
60 env.PrependUnique(LIBS = ['telegesis_wrapper'])
61
62 if env.get('LOGGING'):
63         env.AppendUnique(CPPDEFINES = ['TB_LOG'])
64
65 #####################################################################
66 # Source files and Target(s)
67 ######################################################################
68
69 zw_src = [
70          os.path.join(src_dir, 'resource', 'c_common', 'oic_malloc', 'src', 'oic_malloc.c'),
71          os.path.join(src_dir, 'resource', 'csdk', 'logger', 'src', 'logger.c'),
72              'zigbee_wrapper.c',
73          ]
74
75 env.AppendUnique(ZW_SRC = zw_src)
76
77 if target_os in ['android', 'tizen']:
78         calib = env.SharedLibrary('zigbee_wrapper', env.get('ZW_SRC'))
79 else:
80         calib = env.StaticLibrary('zigbee_wrapper', env.get('ZW_SRC'))
81 env.InstallTarget(calib, 'libzigbee_wrapper')
82 env.UserInstallTargetLib(calib, 'libzigbee_wrapper')