1 #******************************************************************
3 # Copyright 2015 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 # ThingsManager Unit Test build script
26 # SConscript file for Local PKI google tests
27 gtest_env = SConscript('#extlibs/gtest/SConscript')
28 lib_env = gtest_env.Clone()
29 target_os = lib_env.get('TARGET_OS')
31 if lib_env.get('RELEASE'):
32 lib_env.AppendUnique(CCFLAGS = ['-Os'])
33 lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
35 lib_env.AppendUnique(CCFLAGS = ['-g'])
37 if lib_env.get('LOGGING'):
38 lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
40 # Add third party libraries
41 SConscript('#service/third_party_libs.scons', 'lib_env')
43 if target_os in ['linux']:
44 # Verify that 'hippomocks' mocking code is installed.
45 # If not, get it and install it
46 SConscript('#extlibs/hippomocks.scons')
48 ThingsManager_gtest_env = lib_env.Clone()
50 ######################################################################
52 ######################################################################
53 src_dir = ThingsManager_gtest_env.get('SRC_DIR')
55 ######################################################################
57 ######################################################################
58 ThingsManager_gtest_env.AppendUnique(
60 src_dir + '/extlibs/hippomocks-master',
62 '../../../extlibs/timer'
65 if target_os not in ['windows', 'winrt']:
66 ThingsManager_gtest_env.AppendUnique(LIBS = ['dl'])
67 ThingsManager_gtest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
68 if target_os != 'android':
69 ThingsManager_gtest_env.AppendUnique(CXXFLAGS = ['-pthread'])
70 ThingsManager_gtest_env.AppendUnique(LIBS = ['pthread'])
72 ThingsManager_gtest_env.PrependUnique(LIBS = [
75 'connectivity_abstraction',
83 ######################################################################
85 ######################################################################
86 ThingsManager_gtest_src = ThingsManager_gtest_env.Glob('./*.cpp')
88 ThingsManagerTest = ThingsManager_gtest_env.Program('ThingsManagerTest', ThingsManager_gtest_src)
89 Alias("ThingsManagerTest", ThingsManagerTest)
90 ThingsManager_gtest_env.AppendTarget('ThingsManagerTest')
92 if ThingsManager_gtest_env.get('TEST') == '1':
93 if target_os in ['linux']:
94 from tools.scons.RunTest import *
95 run_test(ThingsManager_gtest_env, '',
96 'service/things-manager/unittests/ThingsManagerTest')