#****************************************************************** # # Copyright 2014 Samsung Electronics All Rights Reserved. # #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## # soft-sensor-manager project build script ## Import('env') # Add third party libraries lib_env = env.Clone() SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env') soft_sensor_manager_env = lib_env.Clone() target_os = env.get('TARGET_OS') # As in the source code, it includes arduino Time library (C++) # It requires compile the .c with g++ if target_os == 'arduino': soft_sensor_manager_env.Replace(CC = env.get('CXX')) soft_sensor_manager_env.Replace(CFLAGS = env.get('CXXFLAGS')) ###################################################################### # Build flags ###################################################################### if target_os not in ['windows', 'winrt']: soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-Wall', '-DLINUX','-std=c++0x']) if target_os != 'android': soft_sensor_manager_env.AppendUnique(LIBS = ['pthread']) soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-pthread']) if target_os == 'android': soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions']) soft_sensor_manager_env.AppendUnique(LIBS = ['gnustl_static']) if not env.get('RELEASE'): soft_sensor_manager_env.AppendUnique(LIBS = ['log']) ####################################################################### ## build SSM SDK ####################################################################### sdk_env = soft_sensor_manager_env.Clone() sdk_env.AppendUnique(CPPPATH = ['SSMCore/include']) sdk_env.AppendUnique(CPPPATH = ['SSMCore/src']) sdk_env.AppendUnique(CPPPATH = ['SDK/cpp/include']) ssm_sdk_cpp_src = [ Glob('SDK/cpp/src/*.cpp') ] env.AppendTarget('libSSMSDK') libssmsdk = sdk_env.StaticLibrary( target = 'libSSMSDK', source = [ssm_sdk_cpp_src] ) sdk_env.InstallTarget(libssmsdk, 'libSSMCORE') ###################################################################### # build DiscomfortIndexSensor plugin ###################################################################### DiscomfortIndexSensor_env = soft_sensor_manager_env.Clone() DiscomfortIndexSensor_env.AppendUnique(CCFLAGS = ['-fPIC']) DISCOMFORTINDEXSENSOR_DIR = 'SoftSensorPlugin/DiscomfortIndexSensor/' DiscomfortIndexSensor_env.AppendUnique(CPPPATH = [ DISCOMFORTINDEXSENSOR_DIR + 'include', 'SSMCore/src/SSMInterface/' ]) DiscomfortIndexSensor_src = [ Glob(DISCOMFORTINDEXSENSOR_DIR + 'src/*.cpp')] DiscomfortIndexSensor = DiscomfortIndexSensor_env.SharedLibrary('DiscomfortIndexSensor', DiscomfortIndexSensor_src) DiscomfortIndexSensor_env.InstallTarget(DiscomfortIndexSensor, 'libDiscomfortIndexSensor') ###################################################################### # build BMISensor plugin ###################################################################### BMISensor_env = soft_sensor_manager_env.Clone() BMISensor_env.AppendUnique(CCFLAGS = ['-fPIC']) BMISENSOR_DIR = 'SoftSensorPlugin/BMISensor/' BMISensor_env.AppendUnique(CPPPATH = [ BMISENSOR_DIR + 'include', 'SSMCore/src/SSMInterface/' ]) BMISensor_src = [ Glob(BMISENSOR_DIR + 'src/*.cpp')] BMISensor = BMISensor_env.SharedLibrary('BMISensor', BMISensor_src) BMISensor_env.InstallTarget(BMISensor, 'libBMISensor') ###################################################################### # build SSM CORE ###################################################################### ssmcore_env = soft_sensor_manager_env.Clone() ssmcore_env.AppendUnique(CPPPATH = [ 'SSMCore/include/', 'SSMCore/src/', 'SSMCore/src/Common/' 'SSMCore/src/QueryProcessor/' 'SSMCore/src/SensorProcessor/' 'SSMCore/src/SSMInterface/' ]) import os.path SSMINTERFACE_PATH = 'SSMCore/src/SSMInterface/' if target_os != 'android': omit_src = ['SSMCore_JNI.cpp'] ssminterface_src = [f for f in env.Glob(SSMINTERFACE_PATH + '*.cpp') if os.path.basename(f.path) not in omit_src] else : ssminterface_src = Glob(SSMINTERFACE_PATH + '*.cpp') ssm_core_cpp_src = [ Glob('SSMCore/src/Common/*.cpp'), Glob('SSMCore/src/QueryProcessor/*.cpp'), Glob('SSMCore/src/SensorProcessor/*.cpp'), ssminterface_src, ] ssm_core_c_src = [ 'SSMCore/src/Common/sqlite3.c' ] static_libssmcore = ssmcore_env.StaticLibrary( target = 'SSMCore', source = [ssm_core_cpp_src, ssm_core_c_src] ) ssmcore_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) ssmcore_env.AppendUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap']) ssmcore_env.ParseConfig('pkg-config --libs glib-2.0'); shared_libssmcore = ssmcore_env.SharedLibrary( target = 'SSMCore', source = [ssm_core_cpp_src, ssm_core_c_src] ) ssmcore_env.InstallTarget([shared_libssmcore, static_libssmcore], 'libSSMCORE') ####################################################################### ## build SampleApp ####################################################################### SConscript('SampleApp/SConscript') ###################################################################### # Copy description xml and deliverables ###################################################################### if target_os == 'linux': Command("SSMTesterApp","SampleApp/linux/SSMTesterApp/SSMTesterApp", Copy("$TARGET", "$SOURCE")) Command("SoftSensorDescription.xml", "SoftSensorPlugin/SoftSensorDescription.xml", Copy("$TARGET", "$SOURCE")) Command("THSensorApp","SampleApp/linux/THSensorApp/THSensorApp", Copy("$TARGET", "$SOURCE")) Command("THSensorApp1","SampleApp/linux/THSensorApp1/THSensorApp1", Copy("$TARGET", "$SOURCE")) Command("HeightSensorApp","SampleApp/linux/HeightSensorApp/HeightSensorApp", Copy("$TARGET", "$SOURCE")) Command("WeightSensorApp","SampleApp/linux/WeightSensorApp/WeightSensorApp", Copy("$TARGET", "$SOURCE"))