removed unnecessary BLE code related to u_arraylist_t
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 Samsung Electronics 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 ##
22 # soft-sensor-manager project build script
23 ##
24
25 Import('env')
26
27 # Add third party libraries
28 lib_env = env.Clone()
29 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
30 soft_sensor_manager_env = lib_env.Clone()
31
32 target_os = env.get('TARGET_OS')
33 # As in the source code, it includes arduino Time library (C++)
34 # It requires compile the .c with g++
35 if target_os == 'arduino':
36         soft_sensor_manager_env.Replace(CC = env.get('CXX'))
37         soft_sensor_manager_env.Replace(CFLAGS = env.get('CXXFLAGS'))
38
39 ######################################################################
40 # Build flags
41 ######################################################################
42 if target_os not in ['windows', 'winrt']:
43         soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-Wall', '-DLINUX','-std=c++0x'])
44         if target_os != 'android':
45                 soft_sensor_manager_env.AppendUnique(LIBS = ['pthread'])
46                 soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-pthread'])
47
48 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
49         soft_sensor_manager_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
50
51 if target_os == 'android':
52         soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
53         soft_sensor_manager_env.AppendUnique(LIBS = ['gnustl_shared'])
54
55         if not env.get('RELEASE'):
56                 soft_sensor_manager_env.AppendUnique(LIBS = ['log'])
57
58 #######################################################################
59 ## build SSM SDK
60 #######################################################################
61 sdk_env = soft_sensor_manager_env.Clone()
62 sdk_env.AppendUnique(CPPPATH = ['SSMCore/include'])
63 sdk_env.AppendUnique(CPPPATH = ['SSMCore/src'])
64 sdk_env.AppendUnique(CPPPATH = ['SDK/cpp/include'])
65
66 ssm_sdk_cpp_src = [
67                 Glob('SDK/cpp/src/*.cpp')
68                 ]
69
70 env.AppendTarget('libSSMSDK')
71 libssmsdk = sdk_env.StaticLibrary(
72                 target = 'libSSMSDK',
73                 source = [ssm_sdk_cpp_src]
74                 )
75 sdk_env.InstallTarget(libssmsdk, 'libSSMCORE')
76 sdk_env.UserInstallTargetLib(libssmsdk, 'libSSMCORE')
77
78 ######################################################################
79 # build DiscomfortIndexSensor plugin
80 ######################################################################
81 DiscomfortIndexSensor_env = soft_sensor_manager_env.Clone()
82
83 DiscomfortIndexSensor_env.AppendUnique(CCFLAGS = ['-fPIC'])
84 DISCOMFORTINDEXSENSOR_DIR = 'SoftSensorPlugin/DiscomfortIndexSensor/'
85 DiscomfortIndexSensor_env.AppendUnique(CPPPATH = [
86                 DISCOMFORTINDEXSENSOR_DIR + 'include',
87                 'SSMCore/src/SSMInterface/'
88                 ])
89
90 DiscomfortIndexSensor_src = [ Glob(DISCOMFORTINDEXSENSOR_DIR + 'src/*.cpp')]
91
92 DiscomfortIndexSensor = DiscomfortIndexSensor_env.SharedLibrary('DiscomfortIndexSensor', DiscomfortIndexSensor_src)
93 DiscomfortIndexSensor_env.InstallTarget(DiscomfortIndexSensor, 'libDiscomfortIndexSensor')
94 DiscomfortIndexSensor_env.UserInstallTargetLib(DiscomfortIndexSensor, 'libDiscomfortIndexSensor')
95
96
97
98
99 ######################################################################
100 # build BMISensor plugin
101 ######################################################################
102 BMISensor_env = soft_sensor_manager_env.Clone()
103
104 BMISensor_env.AppendUnique(CCFLAGS = ['-fPIC'])
105 BMISENSOR_DIR = 'SoftSensorPlugin/BMISensor/'
106 BMISensor_env.AppendUnique(CPPPATH = [
107                 BMISENSOR_DIR + 'include',
108                 'SSMCore/src/SSMInterface/'
109                 ])
110
111 BMISensor_src = [ Glob(BMISENSOR_DIR + 'src/*.cpp')]
112
113 BMISensor = BMISensor_env.SharedLibrary('BMISensor', BMISensor_src)
114 BMISensor_env.InstallTarget(BMISensor, 'libBMISensor')
115 BMISensor_env.UserInstallTargetLib(BMISensor, 'libBMISensor')
116
117
118
119 ######################################################################
120 # build SSM CORE
121 ######################################################################
122 ssmcore_env = soft_sensor_manager_env.Clone()
123
124 ssmcore_env.AppendUnique(CPPPATH = [
125                 env.get('SRC_DIR')+'/extlibs',
126                 'SSMCore/include/',
127                 'SSMCore/src/',
128                 'SSMCore/src/Common/'
129                 'SSMCore/src/QueryProcessor/'
130                 'SSMCore/src/SensorProcessor/'
131                 'SSMCore/src/SSMInterface/'
132                 ])
133
134 import os.path
135
136 SSMINTERFACE_PATH = 'SSMCore/src/SSMInterface/'
137
138 if target_os != 'android':
139         omit_src = ['SSMCore_JNI.cpp']
140         ssminterface_src = [f for f in env.Glob(SSMINTERFACE_PATH + '*.cpp') if os.path.basename(f.path) not in omit_src]
141 else :
142         ssminterface_src = Glob(SSMINTERFACE_PATH + '*.cpp')
143
144 ssm_core_cpp_src = [
145                 Glob('SSMCore/src/Common/*.cpp'),
146                 Glob('SSMCore/src/QueryProcessor/*.cpp'),
147                 Glob('SSMCore/src/SensorProcessor/*.cpp'),
148                 ssminterface_src,
149                 ]
150
151 ssm_core_c_src = [
152                 'SSMCore/src/Common/sqlite3.c'
153 ]
154
155
156 static_libssmcore = ssmcore_env.StaticLibrary(
157                 target = 'SSMCore',
158                 source = [ssm_core_cpp_src, ssm_core_c_src]
159                 )
160
161 ssmcore_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
162 ssmcore_env.AppendUnique(LIBS = ['oc', 'octbstack', 'oc_logger',
163             'connectivity_abstraction', 'coap', 'dl'])
164
165 shared_libssmcore = ssmcore_env.SharedLibrary(
166                 target = 'SSMCore',
167                 source = [ssm_core_cpp_src, ssm_core_c_src]
168                 )
169
170 ssmcore_env.InstallTarget([shared_libssmcore, static_libssmcore], 'libSSMCORE')
171 ssmcore_env.UserInstallTargetLib([shared_libssmcore, static_libssmcore], 'libSSMCORE')
172
173 #######################################################################
174 ## build SampleApp
175 #######################################################################
176 SConscript('SampleApp/SConscript')
177
178
179 ######################################################################
180 # Copy description xml and deliverables
181 ######################################################################
182 if target_os == 'linux':
183         Command("SSMTesterApp","SampleApp/linux/SSMTesterApp/SSMTesterApp", Copy("$TARGET", "$SOURCE"))
184         Command("SoftSensorDescription.xml", "SoftSensorPlugin/SoftSensorDescription.xml", Copy("$TARGET", "$SOURCE"))
185         Command("THSensorApp","SampleApp/linux/THSensorApp/THSensorApp", Copy("$TARGET", "$SOURCE"))
186         Command("THSensorApp1","SampleApp/linux/THSensorApp1/THSensorApp1", Copy("$TARGET", "$SOURCE"))
187         Command("HeightSensorApp","SampleApp/linux/HeightSensorApp/HeightSensorApp", Copy("$TARGET", "$SOURCE"))
188         Command("WeightSensorApp","SampleApp/linux/WeightSensorApp/WeightSensorApp", Copy("$TARGET", "$SOURCE"))