Merge test folder of test branch
[iotivity.git] / test / build / linux / SConscriptSK
1 '''
2 ******************************************************************
3 *
4 * Copyright 2017 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 # Build script for Linux
24 #
25 ##
26
27 print '\n---------------Started Building Kill for Linux---------------\n'
28
29 Import('env_linux')
30 import os
31
32 env_linux['CC'] = 'g++'
33
34 iotivity_root = env_linux.get('IOTIVITY_ROOT')
35 iotivity_lib_path = env_linux.get('IOTIVITY_LIB_PATH')
36 iotivity_test_root = env_linux.get('IOTIVITY_TEST_ROOT')
37 variant_dir = env_linux.get('VARIANT_DIR')
38 install_dir = env_linux.get('INSTALL_DIR')
39 test_src_root = iotivity_test_root + '/' + variant_dir
40 secured = env_linux.get('SECURED')
41 common_linux_cppflags = env_linux.get('COMMON_LINUX_CPPFLAGS')
42
43 install_targets = []
44 default_targets = []
45
46 cppflags = Split('-s -pthread -march=native -std=gnu++0x -Wall -fpermissive -DWITH_TCP')
47
48 if secured == '1':
49     cppflags.append('-D__SECURED__')
50     cppflags.append('-D__WITH_DTLS__')
51
52 include_paths = [
53     iotivity_test_root + '/include',
54     iotivity_root + '/resource/include', 
55     iotivity_root + '/resource/csdk/include',
56     iotivity_root + '/resource/csdk/resource-directory/include',
57     iotivity_root + '/resource/csdk/connectivity/api', 
58     iotivity_root + '/resource/csdk/stack/include', 
59     iotivity_root + '/resource/csdk/security/include',
60     iotivity_root + '/resource/csdk/ocsocket/include',
61     iotivity_root + '/resource/csdk/ocrandom/include',
62     iotivity_root + '/resource/csdk/logger/include',
63     iotivity_root + '/resource/c_common/',
64     iotivity_root + '/resource/oc_logger/include',
65     iotivity_root + '/extlibs/cereal/include/',
66     iotivity_root + '/extlibs/timer/',
67     iotivity_root + '/extlibs/tinycbor/tinycbor/src/',
68     iotivity_root + '/extlibs/mbedtls/mbedtls/include',
69     iotivity_root + '/extlibs/timer/' ,
70     iotivity_root + '/resource/csdk/resource-directory/include/',
71     iotivity_lib_path + '/resource/c_common'
72 ]
73
74 libs = Split('libcommon_util libboost_filesystem libboost_thread libboost_system libdl libexpat liboc liboctbstack liboc_logger libconnectivity_abstraction libcoap pthread libglib-2.0 gcov')
75
76 src = [
77     test_src_root + '/common/commonutil/c_cpp/ResourceHelper.cpp',
78     test_src_root + '/common/app/c_cpp/SerialKiller.cpp'
79 ]
80
81 sk_app = env_linux.Program(source = src, target = 'SerialKiller', CPPPATH = include_paths, 
82                 LIBS = libs, LIBPATH = [iotivity_lib_path, '.'] , RPATH = iotivity_lib_path, CPPFLAGS = cppflags + common_linux_cppflags)
83 install_targets += [sk_app]
84
85 install_bin = env_linux.Install(iotivity_test_root + '/' + install_dir, install_targets)
86
87 delete_bin = []
88 i = 0
89 for delete_target in install_targets:
90     delete_bin.append(Command(str(i), [], Delete(delete_target)))
91     i = i +1
92
93 default_targets = install_bin + delete_bin
94
95 env_linux.Default(default_targets)