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 == 'android':
49 soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
50 soft_sensor_manager_env.AppendUnique(LIBS = ['gnustl_shared'])
52 if not env.get('RELEASE'):
53 soft_sensor_manager_env.AppendUnique(LIBS = ['log'])
55 #######################################################################
57 #######################################################################
58 sdk_env = soft_sensor_manager_env.Clone()
59 sdk_env.AppendUnique(CPPPATH = ['SSMCore/include'])
60 sdk_env.AppendUnique(CPPPATH = ['SSMCore/src'])
61 sdk_env.AppendUnique(CPPPATH = ['SDK/cpp/include'])
64 Glob('SDK/cpp/src/*.cpp')
67 env.AppendTarget('libSSMSDK')
68 libssmsdk = sdk_env.StaticLibrary(
70 source = [ssm_sdk_cpp_src]
72 sdk_env.InstallTarget(libssmsdk, 'libSSMCORE')
74 ######################################################################
75 # build DiscomfortIndexSensor plugin
76 ######################################################################
77 DiscomfortIndexSensor_env = soft_sensor_manager_env.Clone()
79 DiscomfortIndexSensor_env.AppendUnique(CCFLAGS = ['-fPIC'])
80 DISCOMFORTINDEXSENSOR_DIR = 'SoftSensorPlugin/DiscomfortIndexSensor/'
81 DiscomfortIndexSensor_env.AppendUnique(CPPPATH = [
82 DISCOMFORTINDEXSENSOR_DIR + 'include',
83 'SSMCore/src/SSMInterface/'
86 DiscomfortIndexSensor_src = [ Glob(DISCOMFORTINDEXSENSOR_DIR + 'src/*.cpp')]
88 DiscomfortIndexSensor = DiscomfortIndexSensor_env.SharedLibrary('DiscomfortIndexSensor', DiscomfortIndexSensor_src)
89 DiscomfortIndexSensor_env.InstallTarget(DiscomfortIndexSensor, 'libDiscomfortIndexSensor')
94 ######################################################################
95 # build BMISensor plugin
96 ######################################################################
97 BMISensor_env = soft_sensor_manager_env.Clone()
99 BMISensor_env.AppendUnique(CCFLAGS = ['-fPIC'])
100 BMISENSOR_DIR = 'SoftSensorPlugin/BMISensor/'
101 BMISensor_env.AppendUnique(CPPPATH = [
102 BMISENSOR_DIR + 'include',
103 'SSMCore/src/SSMInterface/'
106 BMISensor_src = [ Glob(BMISENSOR_DIR + 'src/*.cpp')]
108 BMISensor = BMISensor_env.SharedLibrary('BMISensor', BMISensor_src)
109 BMISensor_env.InstallTarget(BMISensor, 'libBMISensor')
113 ######################################################################
115 ######################################################################
116 ssmcore_env = soft_sensor_manager_env.Clone()
118 ssmcore_env.AppendUnique(CPPPATH = [
119 env.get('SRC_DIR')+'/extlibs',
122 'SSMCore/src/Common/'
123 'SSMCore/src/QueryProcessor/'
124 'SSMCore/src/SensorProcessor/'
125 'SSMCore/src/SSMInterface/'
130 SSMINTERFACE_PATH = 'SSMCore/src/SSMInterface/'
132 if target_os != 'android':
133 omit_src = ['SSMCore_JNI.cpp']
134 ssminterface_src = [f for f in env.Glob(SSMINTERFACE_PATH + '*.cpp') if os.path.basename(f.path) not in omit_src]
136 ssminterface_src = Glob(SSMINTERFACE_PATH + '*.cpp')
139 Glob('SSMCore/src/Common/*.cpp'),
140 Glob('SSMCore/src/QueryProcessor/*.cpp'),
141 Glob('SSMCore/src/SensorProcessor/*.cpp'),
146 'SSMCore/src/Common/sqlite3.c'
150 static_libssmcore = ssmcore_env.StaticLibrary(
152 source = [ssm_core_cpp_src, ssm_core_c_src]
155 ssmcore_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
156 ssmcore_env.AppendUnique(LIBS = ['oc', 'octbstack', 'oc_logger',
157 'connectivity_abstraction', 'coap'])
159 shared_libssmcore = ssmcore_env.SharedLibrary(
161 source = [ssm_core_cpp_src, ssm_core_c_src]
164 ssmcore_env.InstallTarget([shared_libssmcore, static_libssmcore], 'libSSMCORE')
166 #######################################################################
168 #######################################################################
169 SConscript('SampleApp/SConscript')
172 ######################################################################
173 # Copy description xml and deliverables
174 ######################################################################
175 if target_os == 'linux':
176 Command("SSMTesterApp","SampleApp/linux/SSMTesterApp/SSMTesterApp", Copy("$TARGET", "$SOURCE"))
177 Command("SoftSensorDescription.xml", "SoftSensorPlugin/SoftSensorDescription.xml", Copy("$TARGET", "$SOURCE"))
178 Command("THSensorApp","SampleApp/linux/THSensorApp/THSensorApp", Copy("$TARGET", "$SOURCE"))
179 Command("THSensorApp1","SampleApp/linux/THSensorApp1/THSensorApp1", Copy("$TARGET", "$SOURCE"))
180 Command("HeightSensorApp","SampleApp/linux/HeightSensorApp/HeightSensorApp", Copy("$TARGET", "$SOURCE"))
181 Command("WeightSensorApp","SampleApp/linux/WeightSensorApp/WeightSensorApp", Copy("$TARGET", "$SOURCE"))