Merge test folder of test branch
[iotivity.git] / test / build / tizen / ic / SConstruct
1 '''
2 /******************************************************************
3 *
4 * Copyright 2016 Samsung Electronics All Rights Reserved.
5 *
6 *
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 ******************************************************************/
21 '''
22
23 env = Environment(CC='g++')
24
25 test = ARGUMENTS.get('TEST')
26 SDK = ARGUMENTS.get('SDK')
27
28 iotivity_root = 'iotivity'
29 iotivity_test_root = 'test'
30
31 iotivity_include_paths = [
32     iotivity_root + '/resource/include',
33     iotivity_root + '/resource/csdk/include',
34     iotivity_root + '/resource/c_common',
35     iotivity_root + '/resource/csdk/stack/include',
36     iotivity_root + '/resource/csdk/ocsocket/include',
37     iotivity_root + '/resource/csdk/ocrandom/include',
38     iotivity_root + '/resource/oc_logger/include',
39     iotivity_root + '/resource/csdk/resource-directory/include',
40     iotivity_root + '/extlibs/cereal/include',
41     iotivity_root + '/extlibs/timer',
42     iotivity_root + '/extlibs/timer/',
43     iotivity_root + '/resource/c_common/oic_malloc/include',
44     iotivity_root + '/resource/c_common/oic_string/include',
45     iotivity_root + '/resource/csdk/logger/include',
46     iotivity_root + '/extlibs/tinycbor/tinycbor/src',
47     '/usr/include/dlog'
48 ]
49
50 tc_include_paths = [
51     iotivity_test_root + '/include',
52     iotivity_test_root + '/src/tc/ic/gtest/include',
53     iotivity_test_root + '/extlibs/gtest-1.7.0/include'
54 ]
55
56 testapp_include_paths = [
57     iotivity_test_root + '/include',
58     iotivity_test_root + '/src/iBtestapp/modules/ic/c_cpp/include',
59     iotivity_test_root + '/extlibs/gtest-1.7.0/include'
60 ]
61
62 simulator_include_paths = [
63     iotivity_test_root + '/include'
64 ]
65
66 common_src = [ 
67     iotivity_test_root + '/src/common/commonutil/c_cpp/CommonUtil.cpp',
68     iotivity_test_root + '/src/common/commonutil/c_cpp/Configuration.cpp',
69     iotivity_test_root + '/src/common/commonutil/c_cpp/CloudCommonUtil.cpp'
70 ]
71
72 tc_src = [
73     Glob(iotivity_test_root + '/src/tc/ic/gtest/src/btc/*.cpp'),
74     Glob(iotivity_test_root + '/src/tc/ic/gtest/src/stc/*.cpp'),
75     iotivity_test_root + '/src/common/testcase/gtest/IotivitySECTestMain.cpp',
76     iotivity_test_root + '/src/common/commonutil/c_cpp/CommonTestUtil.cpp',
77     Glob(iotivity_test_root + '/src/tc/ic/gtest/src/helper/*.cpp')
78 ]
79
80 testapp_src = [
81     Glob(iotivity_test_root + '/src/iBtestapp/modules/ic/c_cpp/src/*.cpp')
82 ]
83
84 simulator_src = [
85     iotivity_test_root + '/src/testapp/ic/iotivity_ic_server.cpp'
86 ]
87
88 cloud_defines = ['WITH_CLOUD', 'MQ_BROKER', 'WITH_MQ','RD_CLIENT', 'MQ_PUBLISHER', 'MQ_SUBSCRIBER']
89
90 cppflags = Split('-s -pthread -std=gnu++0x -pthread -Wall -DTIZEN -fpermissive -D__TIZEN__')
91
92 libs = Split('libboost_system libboost_filesystem libboost_thread libdl libexpat liboc liboctbstack liboc_logger libconnectivity_abstraction pthread libglib-2.0 libdlog libresource_directory curl libcoap libuuid libpthread')
93
94 if 'tc' in test:
95     env.Program(source = tc_src + common_src, 
96                 target = 'iotivity_ic_test', 
97                 CPPPATH = iotivity_include_paths + tc_include_paths, 
98                 LIBS = ['gtest'] + libs,
99                 LIBPATH = [iotivity_test_root + '/extlibs/gtest-1.7.0/bin/tizen', '.'],
100                 CPPDEFINES = cloud_defines,
101                 CPPFLAGS = cppflags)
102
103 if 'app' in test:
104     env.Program(source = testapp_src + common_src, 
105                 target = 'iotivity_ic_app', 
106                 CPPPATH = iotivity_include_paths + testapp_include_paths, 
107                 LIBS = ['gtest'] + libs,
108                 LIBPATH = [iotivity_test_root + '/extlibs/gtest-1.7.0/bin/tizen', '.'],
109                 CPPDEFINES = cloud_defines,
110                 CPPFLAGS = cppflags)
111
112 if 'tc' in test or 'simulator' in test:
113     env.Program(source= simulator_src + common_src,
114               target='iotivity_ic_server',
115               CPPPATH= iotivity_include_paths + simulator_include_paths,
116               LIBS=libs,
117               CPPDEFINES = cloud_defines,
118               CPPFLAGS = cppflags)