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
27 # Add third party libraries
29 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')
31 src_dir = lib_env.get('SRC_DIR')
33 gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0'
35 rcs_common_env = lib_env.Clone()
36 target_os = env.get('TARGET_OS')
38 release = env.get('RELEASE')
40 ######################################################################
42 ######################################################################
43 rcs_common_env.AppendUnique(CPPPATH = [
44 env.get('SRC_DIR')+'/extlibs',
46 'primitiveResource/include'])
48 rcs_common_env.AppendUnique(CPPPATH = [
49 'expiryTimer/include',
52 rcs_common_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
54 if target_os not in ['windows', 'winrt']:
55 rcs_common_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
56 if target_os != 'android':
57 rcs_common_env.AppendUnique(CXXFLAGS = ['-pthread'])
58 rcs_common_env.AppendUnique(LIBS = ['pthread'])
60 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
61 rcs_common_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
63 if target_os == 'android':
64 rcs_common_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
65 rcs_common_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
67 rcs_common_env.AppendUnique(LIBS = ['dl', 'oc'])
70 rcs_common_env.AppendUnique(CXXFLAGS = ['--coverage'])
71 rcs_common_env.PrependUnique(LIBS = ['gcov'])
73 ######################################################################
74 # Source files and Targets
75 ######################################################################
76 TIMER_SRC_DIR = 'expiryTimer/src/'
77 RESOURCE_SRC = 'primitiveResource/src/'
79 TIMER_SRC_DIR + 'ExpiryTimerImpl.cpp',
80 TIMER_SRC_DIR + 'ExpiryTimer.cpp',
81 RESOURCE_SRC + 'PresenceSubscriber.cpp',
82 RESOURCE_SRC + 'PrimitiveResource.cpp',
83 RESOURCE_SRC + 'RCSException.cpp',
84 RESOURCE_SRC + 'RCSAddress.cpp',
85 RESOURCE_SRC + 'RCSResourceAttributes.cpp',
86 RESOURCE_SRC + 'ResponseStatement.cpp'
89 rcs_common_static = rcs_common_env.StaticLibrary('rcs_common', rcs_common_src)
90 rcs_common_shared = rcs_common_env.SharedLibrary('rcs_common', rcs_common_src)
91 rcs_common_env.InstallTarget([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 env.get('SRC_DIR')+'/extlibs/hippomocks-master',
101 gtest_dir + '/include',
105 gtest = File(gtest_dir + '/lib/.libs/libgtest.a')
106 gtest_main = File(gtest_dir + '/lib/.libs/libgtest_main.a')
108 rcs_common_test_env.PrependUnique(LIBS = [
111 'connectivity_abstraction',
119 rcs_common_test_src = [
120 env.Glob('primitiveResource/unittests/*.cpp'),
121 'expiryTimer/unittests/ExpiryTimerTest.cpp'
124 rcs_common_test = rcs_common_test_env.Program('rcs_common_test', rcs_common_test_src)
125 Alias("rcs_common_test", rcs_common_test)
126 env.AppendTarget('rcs_common_test')
128 if env.get('TEST') == '1':
129 from tools.scons.RunTest import *
130 run_test(rcs_common_test_env, '',
131 'service/resource-encapsulation/src/common/rcs_common_test')