Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / build_common / tizenrt / SConscript
1 ###########################################################################
2 #
3 # Copyright 2016 Samsung Electronics All Rights Reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14 # either express or implied. See the License for the specific
15 # language governing permissions and limitations under the License.
16 #
17 ###########################################################################
18
19 ##
20 # This script includes tizenrt specific config
21 ##
22 import os
23 import platform
24
25 Import('env')
26
27 print("Reading tizenrt configuration script")
28
29 host = platform.system().lower()
30
31 default_os_dir = env.GetLaunchDir() + '/../../../os'
32
33 # TIZENRT_OS_DIR build option
34 if env.get('TIZENRT_OS_DIR'):
35         tizenrt_os_dir = ARGUMENTS.get('TIZENRT_OS_DIR',default_os_dir)
36         print('TIZENRT_OS_DIR = ' + tizenrt_os_dir)
37 else:
38         print('''
39 *************************************** Info **********************************
40 *   Environment variable TIZENRT_OS_DIR must be set to absolute path of       *
41 *   tizenrt os directory. To set, please specify TIZENRT_OS_DIR as follows:   *
42 *       scons TIZENRT_OS_DIR= <path to tizenrt os directory>                  *
43 *******************************************************************************
44 ''')
45
46 target_arch = env.get('TARGET_ARCH')
47
48 env.AppendUnique(CCFLAGS = ['-fno-builtin'])
49 # Set release/debug flags
50 if env.get('RELEASE') == 1:
51         env.AppendUnique(CCFLAGS = ['-Os'])
52         env.AppendUnique(CPPDEFINES = ['NDEBUG'])
53 else:
54         env.AppendUnique(CCFLAGS = ['-g'])
55
56 # we have variety of macros for tizenrt!!
57 #env.AppendUnique(CPPDEFINES = ['CONFIG_CLOCK_MONOTONIC'])
58 env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '__TIZENRT__'])
59 # Set device name to __OIC_DEVICE_NAME__
60 env.AppendUnique(CPPDEFINES = ['-D__OIC_DEVICE_NAME__=' + "\'\"" + env.get('DEVICE_NAME') + "\"\'"])
61 if env.get('LOGGING'):
62         print('LOGGING is enabled')
63         env.AppendUnique(CPPDEFINES = ['TB_LOG'])
64
65
66 # Determine dependency for tizenrt_os_dir
67
68 dep_src_dir1 =  os.path.join(tizenrt_os_dir, 'include')
69 dep_src_dir2 =  os.path.join(tizenrt_os_dir, 'include/tinyara')
70 dep_lib_dir =  '/usr/lib/arm-none-eabi/include'
71
72
73 # Add directories to search for header files and external libraries
74 env.AppendUnique(CPPPATH = [ dep_src_dir1, dep_src_dir2 ])
75 env.AppendUnique(LIBPATH = [ dep_lib_dir ])
76
77 print(env.get('CPPPATH'))