1 #******************************************************************
3 # Copyright 2015 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 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # rcs_common (primitiveResource and expiryTimer) build script
26 # SConscript file for Local PKI google tests
27 gtest_env = SConscript('#extlibs/gtest/SConscript')
28 lib_env = gtest_env.Clone()
32 # Add third party libraries
33 SConscript(lib_env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')
34 rcs_common_env = lib_env.Clone()
35 target_os = rcs_common_env.get('TARGET_OS')
36 release = rcs_common_env.get('RELEASE')
37 src_dir = rcs_common_env.get('SRC_DIR')
39 ######################################################################
41 ######################################################################
42 rcs_common_env.AppendUnique(CPPPATH = [
43 rcs_common_env.get('SRC_DIR')+'/extlibs',
45 'primitiveResource/include'])
47 rcs_common_env.AppendUnique(CPPPATH = [
48 'expiryTimer/include',
51 rcs_common_env.AppendUnique(LIBPATH = [rcs_common_env.get('BUILD_DIR')])
53 if target_os not in ['windows', 'winrt']:
54 rcs_common_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
55 if target_os != 'android':
56 rcs_common_env.AppendUnique(CXXFLAGS = ['-pthread'])
57 rcs_common_env.AppendUnique(LIBS = ['pthread'])
59 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
60 rcs_common_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
62 if target_os == 'android':
63 rcs_common_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
64 rcs_common_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
66 rcs_common_env.AppendUnique(LIBS = ['dl', 'oc'])
69 rcs_common_env.AppendUnique(CXXFLAGS = ['--coverage'])
70 rcs_common_env.PrependUnique(LIBS = ['gcov'])
72 ######################################################################
73 # Source files and Targets
74 ######################################################################
75 TIMER_SRC_DIR = 'expiryTimer/src/'
76 RESOURCE_SRC = 'primitiveResource/src/'
78 TIMER_SRC_DIR + 'ExpiryTimerImpl.cpp',
79 TIMER_SRC_DIR + 'ExpiryTimer.cpp',
80 RESOURCE_SRC + 'PresenceSubscriber.cpp',
81 RESOURCE_SRC + 'PrimitiveResource.cpp',
82 RESOURCE_SRC + 'RCSException.cpp',
83 RESOURCE_SRC + 'RCSAddress.cpp',
84 RESOURCE_SRC + 'RCSResourceAttributes.cpp',
85 RESOURCE_SRC + 'RCSRepresentation.cpp'
88 rcs_common_static = rcs_common_env.StaticLibrary('rcs_common', rcs_common_src)
89 rcs_common_shared = rcs_common_env.SharedLibrary('rcs_common', rcs_common_src)
90 rcs_common_env.InstallTarget([rcs_common_static,rcs_common_shared], 'rcs_common')
91 rcs_common_env.UserInstallTargetLib([rcs_common_static,rcs_common_shared], 'rcs_common')
93 ######################################################################
94 # Build Test Expiry Timer and primitive Resource
95 ######################################################################
96 if target_os == 'linux':
97 rcs_common_test_env = rcs_common_env.Clone();
99 rcs_common_test_env.PrependUnique(CPPPATH = [
100 rcs_common_test_env.get('SRC_DIR')+'/extlibs/hippomocks-master',
104 rcs_common_test_env.PrependUnique(LIBS = [
107 'connectivity_abstraction',
115 rcs_common_test_src = [
116 rcs_common_test_env.Glob('primitiveResource/unittests/*.cpp'),
117 'expiryTimer/unittests/ExpiryTimerTest.cpp'
120 rcs_common_test = rcs_common_test_env.Program('rcs_common_test', rcs_common_test_src)
121 Alias("rcs_common_test", rcs_common_test)
122 rcs_common_test_env.AppendTarget('rcs_common_test')
124 if rcs_common_test_env.get('TEST') == '1':
125 from tools.scons.RunTest import *
126 run_test(rcs_common_test_env, '',
127 'service/resource-encapsulation/src/common/rcs_common_test')