Update UnitTest Code about "Resource Broker"
[platform/upstream/iotivity.git] / service / resource-manipulation / SConscript
1 #******************************************************************
2 #
3 # Copyright 2015 Samsung Electronics All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
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
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 ######################################################################
22 #  Resource-manipulation build script
23 ######################################################################
24 import platform
25 Import('env')
26
27 SConscript('src/common/SConscript')
28 SConscript('src/serverBuilder/SConscript')
29 SConscript('src/resourceContainer/SConscript')
30
31 ######################################################################
32 #building Resource client, resourceBroker and resourceCache
33 ######################################################################
34
35 if env.get('RELEASE'):
36         env.AppendUnique(CCFLAGS = ['-Os'])
37         env.AppendUnique(CPPDEFINES = ['NDEBUG'])
38 else:
39         env.AppendUnique(CCFLAGS = ['-g'])
40
41 if env.get('LOGGING'):
42         env.AppendUnique(CPPDEFINES = ['TB_LOG'])
43
44 # Add third party libraries
45 lib_env = env.Clone()
46 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
47
48 resourceClient_env = lib_env.Clone()
49 target_os = env.get('TARGET_OS')
50
51 ######################################################################
52 # Build flags
53 ######################################################################
54 resourceClient_env.AppendUnique(CPPPATH = ['include'])
55 resourceClient_env.AppendUnique(CPPPATH = ['src/common/primitiveResource/include'])
56 resourceClient_env.AppendUnique(CPPPATH = ['src/common/expiryTimer/include'])
57 resourceClient_env.AppendUnique(CPPPATH = ['src/common/expiryTimer/src'])
58 resourceClient_env.AppendUnique(CPPPATH = ['src/resourceBroker/include'])
59 resourceClient_env.AppendUnique(CPPPATH = ['src/resourceCache/include'])
60
61 resourceClient_env.PrependUnique(LIBS = ['oc', 'rcs_common', 'octbstack', 'gnustl_shared','oc_logger', 'compatibility', 'log'])
62
63 if target_os not in ['windows', 'winrt']:
64     resourceClient_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
65 if target_os == 'linux':
66    resourceClient_env.AppendUnique(LIBS = ['pthread'])
67    
68 if target_os == 'android':
69     resourceClient_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
70     resourceClient_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])
71
72 resourceClient_env.AppendUnique(LIBS = ['dl'])
73
74 ######################################################################
75 # Source files and Targets
76 ######################################################################
77 BROKER_SRC_DIR = 'src/resourceBroker/src/'
78 CACHE_SRC_DIR = 'src/resourceCache/src/'
79 RESOURCECLIENT_DIR = 'src/'
80 client_src = [
81         BROKER_SRC_DIR + 'DeviceAssociation.cpp',
82         BROKER_SRC_DIR + 'DevicePresence.cpp',
83         BROKER_SRC_DIR + 'ResourcePresence.cpp',
84         BROKER_SRC_DIR + 'ResourceBroker.cpp',
85         CACHE_SRC_DIR + 'DataCache.cpp',
86         CACHE_SRC_DIR + 'ResourceCacheManager.cpp',
87         RESOURCECLIENT_DIR + 'ResourceClient.cpp'
88                 ]
89 ResourceClientsdk = resourceClient_env.StaticLibrary('rcs_client', client_src)
90 resourceClient_env.InstallTarget(ResourceClientsdk , 'librcs_client')
91
92 ######################################################################
93 # Build Sample App: SampleResourceClient & SampleResourceServer
94 ######################################################################
95 SConscript('examples/SConscript')
96
97 ######################################################################
98 # Build UnitTests Resource Client , resourceCache and resourceBroker
99 ################################################ ######################
100 SConscript('unittests/SConscript')
101 SConscript('src/resourceCache/unittests/SConscript')
102 #SConscript('src/resourceBroker/unittest/SConscript')
103