Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / plugins / zigbee_wrapper / telegesis_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.path
25
26 Import('env')
27
28 target_os = env.get('TARGET_OS')
29 src_dir = env.get('SRC_DIR')
30 tw_path = os.path.join(src_dir, 'plugins')
31
32 #####################################################################
33 # Source files and Target(s)
34 ######################################################################
35
36 print("Reading Telegesis Wrapper (TW) script")
37
38 env.AppendUnique(CPPPATH = [ os.path.join(tw_path, 'include'),
39                              os.path.join(tw_path, 'include', 'internal'),
40                              os.path.join(src_dir, 'resource', 'oc_logger', 'include'),
41                              os.path.join(src_dir, 'resource', 'csdk', 'stack', 'include'),
42                              os.path.join(src_dir, 'resource', 'csdk', 'logger', 'include'),
43                              os.path.join(src_dir, 'resource', 'c_common', 'oic_string', 'include'),
44                              os.path.join(tw_path, 'zigbee_wrapper', 'telegesis_wrapper', 'include')
45                              ])
46
47 if target_os not in ['arduino', 'windows']:
48         env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
49
50 if target_os in ['darwin','ios']:
51         env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
52
53 tw_src = [
54          os.path.join(src_dir, 'resource', 'c_common', 'oic_string', 'src', 'oic_string.c'),
55          os.path.join(src_dir, 'resource', 'csdk', 'logger', 'src', 'logger.c'),
56          'twsocketlist.c',
57          'telegesis_socket.c',
58          'telegesis_wrapper.c'
59          ]
60
61 env.AppendUnique(TW_SRC = tw_src)
62
63 if target_os in ['android', 'tizen']:
64         calib = env.SharedLibrary('telegesis_wrapper', env.get('TW_SRC'))
65 else:
66         calib = env.StaticLibrary('telegesis_wrapper', env.get('TW_SRC'))
67 env.InstallTarget(calib, 'libtelegesis_wrapper')
68 env.UserInstallTargetLib(calib, 'libtelegesis_wrapper')