1 #******************************************************************
3 # Copyright 2016 Samsung Electronics 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 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
25 # CoAP-HTTP Proxy Unit Test build script
27 # SConscript file for Local PKI google tests
28 gtest_env = SConscript('#extlibs/gtest/SConscript')
29 lib_env = gtest_env.Clone()
31 if lib_env.get('RELEASE'):
32 lib_env.AppendUnique(CCFLAGS = ['-Os'])
33 lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
35 lib_env.AppendUnique(CCFLAGS = ['-g'])
37 if lib_env.get('LOGGING'):
38 lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
40 SConscript('#service/third_party_libs.scons', 'lib_env')
42 ######################################################################
44 ######################################################################
45 src_dir = lib_env.get('SRC_DIR')
47 CoAP_test_env = lib_env.Clone()
48 target_os = CoAP_test_env.get('TARGET_OS')
50 ######################################################################
52 ######################################################################
54 CoAP_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
55 CoAP_test_env.AppendUnique(LIBS = [
56 'coap_http_proxy','oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
58 if target_os not in ['windows']:
59 CoAP_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
61 if not CoAP_test_env.get('RELEASE'):
62 CoAP_test_env.PrependUnique(LIBS = ['gcov'])
63 CoAP_test_env.AppendUnique(CXXFLAGS = ['--coverage'])
65 CoAP_test_env.AppendUnique(CPPPATH = [src_dir + '/extlibs/hippomocks-master',
67 os.path.join(src_dir, 'resource/csdk/stack/include'),
68 os.path.join(src_dir, 'resource/csdk/connectivity/common/inc/'),
69 os.path.join(src_dir, 'resource/csdk/connectivity/lib/libcoap-4.1.1'),
70 os.path.join(src_dir, 'extlibs/cjson'),
73 CoAP_test_env.AppendUnique(CPPPATH = ['../../resource-encapsulation/include'])
74 CoAP_test_env.AppendUnique(CPPPATH = ['../../resource-encapsulation/src/common/primitiveResource/include'])
75 CoAP_test_env.AppendUnique(CPPPATH = ['../../resource-encapsulation/src/common/utils/include'])
78 if target_os in ['linux']:
79 CoAP_test_env.AppendUnique(LIBS = ['pthread', 'curl'])
82 if CoAP_test_env.get('SECURED') == '1':
83 CoAP_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
84 ######################################################################
86 ######################################################################
88 CoAP_unit_test_src = CoAP_test_env.Glob('./CoAPHttpUnitTest.cpp')
89 CoAP_unit_test = CoAP_test_env.Program('CoAP_unit_test', CoAP_unit_test_src)
90 Alias("CoAP_unit_test", CoAP_unit_test)
91 CoAP_test_env.AppendTarget('CoAP_unit_test')
92 CoAP_test_env.InstallTarget(CoAP_unit_test, 'CoAP_unit_test')