Imported Upstream version 1.1.1
[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 os
22 import os.path
23
24 # SConscript file for Local PKI google tests
25 gtest_env = SConscript('#extlibs/gtest/SConscript')
26 unittests_env = gtest_env.Clone()
27 src_dir = unittests_env.get('SRC_DIR')
28 pi_dir = os.path.join(src_dir, 'plugins')
29 build_dir = unittests_env.get('BUILD_DIR')
30 target_os = unittests_env.get('TARGET_OS')
31
32 ######################################################################
33 # Build flags
34 ######################################################################
35 unittests_env.PrependUnique(CPPPATH = [
36                 os.path.join(pi_dir, 'include'),
37                 ])
38
39 if target_os not in ['windows']:
40         unittests_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
41         unittests_env.PrependUnique(LIBS = ['pthread'])
42 unittests_env.AppendUnique(LIBPATH = [unittests_env.get('BUILD_DIR')])
43 unittests_env.PrependUnique(LIBS = [
44                 'plugin_interface',
45                 'oc',
46                 'octbstack',
47                 'oc_logger',
48                 'connectivity_abstraction',
49                 'coap',
50                 'gtest',
51                 'gtest_main'
52                 ])
53
54 if unittests_env.get('LOGGING'):
55         unittests_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
56
57 ######################################################################
58 # Source files and Targets
59 ######################################################################
60 piunittests = unittests_env.Program('piunittests', ['plugininterfacetest.cpp'])
61
62 Alias("piunittests", [piunittests])
63
64 unittests_env.AppendTarget('piunittests')
65 if unittests_env.get('TEST') == '1':
66         if target_os in ['linux']:
67                 from tools.scons.RunTest import *
68                 run_test(unittests_env,
69                          'plugins_unittests.memcheck',
70                          'plugins/unittests/piunittests')
71