Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / plugins / unittests / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
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
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 Import('env')
22 import os
23 import os.path
24 unittests_env = env.Clone()
25
26 src_dir = unittests_env.get('SRC_DIR')
27 pi_dir = os.path.join(src_dir, 'plugins')
28 build_dir = env.get('BUILD_DIR')
29 ######################################################################
30 # Build flags
31 ######################################################################
32 unittests_env.PrependUnique(CPPPATH = [
33                 os.path.join(pi_dir, 'include'),
34                 '#extlibs/gtest/gtest-1.7.0/include',
35                 ])
36
37 unittests_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
38 unittests_env.PrependUnique(LIBS = ['-lpthread'])
39 unittests_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
40 unittests_env.AppendUnique(LIBPATH = [os.path.join(src_dir, 'extlibs', 'gtest', 'gtest-1.7.0', 'lib', '.libs')])
41 unittests_env.PrependUnique(LIBS = [
42                 'plugin_interface',
43                 'oc',
44                 'octbstack',
45                 'oc_logger',
46                 'connectivity_abstraction',
47                 'coap',
48                 'gtest',
49                 'gtest_main'
50                 ])
51
52 if env.get('LOGGING'):
53         unittests_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
54
55 ######################################################################
56 # Source files and Targets
57 ######################################################################
58 piunittests = unittests_env.Program('piunittests', ['plugininterfacetest.cpp'])
59
60 Alias("piunittests", [piunittests])
61
62 env.AppendTarget('piunittests')
63 if env.get('TEST') == '1':
64         target_os = env.get('TARGET_OS')
65         if target_os == 'linux':
66                 from tools.scons.RunTest import *
67                 run_test(unittests_env,
68                          'plugins_unittests.memcheck',
69                          'plugins/unittests/piunittests')
70