1 #******************************************************************
3 # Copyright 2014 Intel Mobile Communications GmbH 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 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 unittests_env = env.Clone()
26 src_dir = unittests_env.get('SRC_DIR')
27 ######################################################################
29 ######################################################################
30 unittests_env.PrependUnique(CPPPATH = [
32 '../oc_logger/include',
33 '../csdk/stack/include',
34 '../csdk/ocsocket/include',
35 '../csdk/ocrandom/include',
36 '../csdk/logger/include',
37 '../../extlibs/gtest/gtest-1.7.0/include',
38 '../../extlibs/hippomocks-master/HippoMocks',
39 '../../extlibs/hippomocks-master/HippoMocksTest'
42 unittests_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
43 unittests_env.AppendUnique(LIBS = ['-lpthread'])
44 unittests_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
45 unittests_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
46 unittests_env.PrependUnique(LIBS = [
50 'connectivity_abstraction',
56 if env.get('SECURED') == '1':
57 unittests_env.AppendUnique(LIBS = ['tinydtls'])
58 unittests_env.ParseConfig('pkg-config --libs glib-2.0');
60 if not env.get('RELEASE'):
61 unittests_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
63 ######################################################################
64 # Source files and Targets
65 ######################################################################
66 unittests = unittests_env.Program('unittests', ['ConstructResourceTest.cpp',
68 'OCRepresentationTest.cpp',
70 'OCExceptionTest.cpp'])
72 Alias("unittests", [unittests])
74 env.AppendTarget('unittests')
75 if env.get('TEST') == '1':
76 target_os = env.get('TARGET_OS')
77 if target_os == 'linux':
78 out_dir = env.get('BUILD_DIR')
79 result_dir = env.get('BUILD_DIR') + '/test_out/'
80 if not os.path.isdir(result_dir):
81 os.makedirs(result_dir)
82 unittests_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
83 unittests_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
84 unittests_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
85 ut = unittests_env.Command ('ut', None,
86 [out_dir + '/resource/unittests/unittests'])