Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / plugins / 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 pi_path = os.path.join(src_dir, 'plugins')
31
32 print"Reading PI script"
33
34 ######################################################################
35 # Build flags
36 ######################################################################
37
38 env.PrependUnique(CPPPATH = [ os.path.join(src_dir, 'resource', 'c_common', 'oic_malloc', 'include'),
39                               os.path.join(src_dir, 'resource', 'c_common', 'oic_string', 'include'),
40                               os.path.join(src_dir, 'resource', 'c_common', 'oic_time', '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                               os.path.join(src_dir, 'resource', 'csdk', 'connectivity', 'lib', 'libcoap-4.1.1')
45                             ])
46 env.AppendUnique(CPPPATH = [ os.path.join(pi_path, 'include'),
47                              os.path.join(pi_path, 'include', 'internal'),
48                              os.path.join(pi_path, 'zigbee_wrapper', 'include'),
49                              os.path.join(pi_path, 'include', 'internal')
50                            ])
51
52 if target_os not in ['arduino', 'windows', 'winrt']:
53         env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
54
55 if target_os in ['darwin','ios']:
56         env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
57
58 env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
59 env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
60 env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
61
62 env.PrependUnique(LIBS = ['zigbee_wrapper'])
63
64 if env.get('LOGGING'):
65         env.AppendUnique(CPPDEFINES = ['TB_LOG'])
66
67 #####################################################################
68 # Source files and Target(s)
69 ######################################################################
70 pi_src = [
71          os.path.join(src_dir, 'resource', 'csdk', 'logger', 'src', 'logger.c'),
72          'pluginlist.c',
73          'plugininterface.c',
74              ]
75
76 env.AppendUnique(PI_SRC = pi_src)
77
78 print "Include path is %s" % env.get('CPPPATH')
79 print "Files path is %s" % env.get('PI_SRC')
80 if target_os in ['android', 'tizen']:
81         calib = env.SharedLibrary('plugin_interface', env.get('PI_SRC'))
82 else:
83         calib = env.StaticLibrary('plugin_interface', env.get('PI_SRC'))
84 env.InstallTarget(calib, 'libplugin_interface')
85 env.UserInstallTargetLib(calib, 'libplugin_interface')
86