Merge "Implementation of connectivity abstraction feature Release v0.5" into connecti...
[platform/upstream/iotivity.git] / extra_options.scons
1 ######################################################################
2 # This script manages extra build options
3 #
4 ######################################################################
5 import os
6 import platform
7
8 Import('env')
9
10 target_os = env.get('TARGET_OS')
11 target_arch = env.get('TARGET_ARCH')
12 src_dir = env.get('SRC_DIR')
13
14 # Add 'OIC_UTILS' build option for user to set oic-utilities project path
15 if target_os not in ['linux', 'darwin', 'arduino']:
16         default_dir = os.environ.get('OIC_UTILS')
17         if not default_dir:
18                 default_dir = os.path.abspath(src_dir + '/../oic-utilities')
19         else:
20                 default_dir = os.path.abspath(default_dir)
21
22         if not os.path.exists(default_dir):
23                 default_dir = None
24
25         help_vars = Variables()
26         help_vars.Add(PathVariable('OIC_UTILS', 'oic-utilities project path', default_dir))
27         help_vars.Update(env)
28         Help(help_vars.GenerateHelpText(env))
29
30         utils_path = env.get('OIC_UTILS', default_dir)
31         if utils_path:
32                 utils_path = os.path.abspath(utils_path)
33
34         if not utils_path or not os.path.exists(utils_path):
35                 print '''
36 *********************************** Error: ************************************
37 *   oic-utilities project directory isn't set properly, please set enviornment*
38 * variable OIC_UTILS or set it in command line:                               *
39 *     # scons  OIC_UTILS=<path to oic-utilities> ...                          *
40 *******************************************************************************
41 '''
42                 Exit(1)
43
44 if target_os == 'arduino':
45         # Add 'NET' build option, let user select board network connection type
46         vars = Variables()
47         vars.Add(EnumVariable('NET', 'Network connection type', 'Ethernet', ['Ethernet', 'Wifi']))
48         vars.Update(env)
49         Help(vars.GenerateHelpText(env))
50
51 # check 'cereal' library, temporarily put it here
52 if not os.path.exists(src_dir + '/extlibs/cereal'):
53         print '''
54 *********************************** Error: **************************************
55 *  'Cereal' library doesn't exist. please download cereal to extlibs directory  *
56 * add apply the patch as following:                                             *
57 *     $ git clone https://github.com/USCiLab/cereal.git <src_dir>/extlibs/cereal*
58 *     $ cd <src_dir>/extlibs/cereal                                             *
59 *     $ git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245               *
60 *     $ git apply ../../resource/patches/cereal_gcc46.patch                     *
61 *********************************************************************************
62 '''
63         Exit(1)
64 else:
65         env.AppendUnique(CPPPATH = [src_dir + '/extlibs/cereal/include'])