1 #******************************************************************
3 # Copyright 2014 Samsung Electronics All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # soft-sensor-manager project build script
27 # Add third party libraries
29 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
30 soft_sensor_manager_env = lib_env.Clone()
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'))
39 ######################################################################
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'])
48 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
49 soft_sensor_manager_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
51 if target_os == 'android':
52 soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
53 soft_sensor_manager_env.AppendUnique(LIBS = ['gnustl_shared'])
55 if not env.get('RELEASE'):
56 soft_sensor_manager_env.AppendUnique(LIBS = ['log'])
58 #######################################################################
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'])
67 Glob('SDK/cpp/src/*.cpp')
70 env.AppendTarget('libSSMSDK')
71 libssmsdk = sdk_env.StaticLibrary(
73 source = [ssm_sdk_cpp_src]
75 sdk_env.InstallTarget(libssmsdk, 'libSSMCORE')
76 sdk_env.UserInstallTargetLib(libssmsdk, 'libSSMCORE')
78 ######################################################################
79 # build DiscomfortIndexSensor plugin
80 ######################################################################
81 DiscomfortIndexSensor_env = soft_sensor_manager_env.Clone()
83 DiscomfortIndexSensor_env.AppendUnique(CCFLAGS = ['-fPIC'])
84 DISCOMFORTINDEXSENSOR_DIR = 'SoftSensorPlugin/DiscomfortIndexSensor/'
85 DiscomfortIndexSensor_env.AppendUnique(CPPPATH = [
86 DISCOMFORTINDEXSENSOR_DIR + 'include',
87 'SSMCore/src/SSMInterface/'
90 DiscomfortIndexSensor_src = [ Glob(DISCOMFORTINDEXSENSOR_DIR + 'src/*.cpp')]
92 DiscomfortIndexSensor = DiscomfortIndexSensor_env.SharedLibrary('DiscomfortIndexSensor', DiscomfortIndexSensor_src)
93 DiscomfortIndexSensor_env.InstallTarget(DiscomfortIndexSensor, 'libDiscomfortIndexSensor')
94 DiscomfortIndexSensor_env.UserInstallTargetLib(DiscomfortIndexSensor, 'libDiscomfortIndexSensor')
99 ######################################################################
100 # build BMISensor plugin
101 ######################################################################
102 BMISensor_env = soft_sensor_manager_env.Clone()
104 BMISensor_env.AppendUnique(CCFLAGS = ['-fPIC'])
105 BMISENSOR_DIR = 'SoftSensorPlugin/BMISensor/'
106 BMISensor_env.AppendUnique(CPPPATH = [
107 BMISENSOR_DIR + 'include',
108 'SSMCore/src/SSMInterface/'
111 BMISensor_src = [ Glob(BMISENSOR_DIR + 'src/*.cpp')]
113 BMISensor = BMISensor_env.SharedLibrary('BMISensor', BMISensor_src)
114 BMISensor_env.InstallTarget(BMISensor, 'libBMISensor')
115 BMISensor_env.UserInstallTargetLib(BMISensor, 'libBMISensor')
119 ######################################################################
121 ######################################################################
122 ssmcore_env = soft_sensor_manager_env.Clone()
124 ssmcore_env.AppendUnique(CPPPATH = [
125 env.get('SRC_DIR')+'/extlibs',
128 'SSMCore/src/Common/'
129 'SSMCore/src/QueryProcessor/'
130 'SSMCore/src/SensorProcessor/'
131 'SSMCore/src/SSMInterface/'
136 SSMINTERFACE_PATH = 'SSMCore/src/SSMInterface/'
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]
142 ssminterface_src = Glob(SSMINTERFACE_PATH + '*.cpp')
145 Glob('SSMCore/src/Common/*.cpp'),
146 Glob('SSMCore/src/QueryProcessor/*.cpp'),
147 Glob('SSMCore/src/SensorProcessor/*.cpp'),
152 'SSMCore/src/Common/sqlite3.c'
156 static_libssmcore = ssmcore_env.StaticLibrary(
158 source = [ssm_core_cpp_src, ssm_core_c_src]
161 ssmcore_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
162 ssmcore_env.AppendUnique(LIBS = ['oc', 'octbstack', 'oc_logger',
163 'connectivity_abstraction', 'coap', 'dl'])
165 shared_libssmcore = ssmcore_env.SharedLibrary(
167 source = [ssm_core_cpp_src, ssm_core_c_src]
170 ssmcore_env.InstallTarget([shared_libssmcore, static_libssmcore], 'libSSMCORE')
171 ssmcore_env.UserInstallTargetLib([shared_libssmcore, static_libssmcore], 'libSSMCORE')
173 #######################################################################
175 #######################################################################
176 SConscript('SampleApp/SConscript')
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"))