summaryrefslogtreecommitdiff
path: root/service/soft-sensor-manager/SConscript
blob: 8dceeebeae8be493b9a0fc260e1441563e4c88d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
##
# 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 = ['-std=c++0x', '-Wall', '-DLINUX'])
	if target_os != 'android':
		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', 'compatibility'])

	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 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'
]

libssmcore = ssmcore_env.StaticLibrary(
		target = 'SSMCore',
		source = [ssm_core_cpp_src, ssm_core_c_src]
		)

ssmcore_env.InstallTarget(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"))