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 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 ######################################################################
22 # Resource-encapsulation build script
23 ######################################################################
27 SConscript('src/common/SConscript')
28 SConscript('src/serverBuilder/SConscript')
30 ######################################################################
31 #building Resource client, resourceBroker and resourceCache
32 ######################################################################
34 if env.get('RELEASE'):
35 env.AppendUnique(CCFLAGS = ['-Os'])
36 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
38 env.AppendUnique(CCFLAGS = ['-g'])
40 if env.get('LOGGING'):
41 env.AppendUnique(CPPDEFINES = ['TB_LOG'])
43 # Add third party libraries
45 SConscript('#service/third_party_libs.scons', 'lib_env')
47 resourceClient_env = lib_env.Clone()
48 target_os = env.get('TARGET_OS')
50 ######################################################################
52 ######################################################################
53 resourceClient_env.AppendUnique(CPPPATH = [
55 'src/common/primitiveResource/include',
56 'src/common/expiryTimer/include',
57 'src/common/utils/include',
58 'src/resourceBroker/include',
59 'src/resourceCache/include'
62 resourceClient_env.PrependUnique(LIBS = ['oc', 'rcs_common', 'octbstack','oc_logger'])
64 if target_os not in ['windows']:
65 resourceClient_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
66 resourceClient_env.AppendUnique(LIBS = ['dl'])
67 if target_os in ['linux']:
68 resourceClient_env.AppendUnique(LIBS = ['pthread'])
70 if target_os in ['android']:
71 resourceClient_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
72 resourceClient_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
74 if target_os in ['linux']:
75 if not env.get('RELEASE'):
76 resourceClient_env.PrependUnique(LIBS = ['gcov'])
77 resourceClient_env.AppendUnique(CXXFLAGS = ['--coverage'])
79 ######################################################################
80 # Source files and Targets
81 ######################################################################
82 BROKER_SRC_DIR = 'src/resourceBroker/src/'
83 CACHE_SRC_DIR = 'src/resourceCache/src/'
84 RESOURCECLIENT_DIR = 'src/resourceClient/'
87 BROKER_SRC_DIR + 'DeviceAssociation.cpp',
88 BROKER_SRC_DIR + 'DevicePresence.cpp',
89 BROKER_SRC_DIR + 'ResourcePresence.cpp',
90 BROKER_SRC_DIR + 'ResourceBroker.cpp',
91 CACHE_SRC_DIR + 'DataCache.cpp',
92 CACHE_SRC_DIR + 'ResourceCacheManager.cpp',
93 CACHE_SRC_DIR + 'ObserveCache.cpp',
94 RESOURCECLIENT_DIR + 'RCSDiscoveryManager.cpp',
95 RESOURCECLIENT_DIR + 'RCSDiscoveryManagerImpl.cpp',
96 RESOURCECLIENT_DIR + 'RCSRemoteResourceObject.cpp'
98 ResourceClientsdk_static = resourceClient_env.StaticLibrary('rcs_client', client_src)
99 if target_os not in ['ios']:
100 ResourceClientsdk_shared = resourceClient_env.SharedLibrary('rcs_client', client_src)
101 resourceClient_env.InstallTarget([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
102 resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
104 resourceClient_env.InstallTarget([ResourceClientsdk_static], 'rcs_client')
105 resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static], 'rcs_client')
106 resourceClient_env.UserInstallTargetHeader('include/RCSAddress.h', 'service/resource-encapsulation', 'RCSAddress.h')
107 resourceClient_env.UserInstallTargetHeader('include/RCSDiscoveryManager.h', 'service/resource-encapsulation', 'RCSDiscoveryManager.h')
108 resourceClient_env.UserInstallTargetHeader('include/RCSRemoteResourceObject.h', 'service/resource-encapsulation', 'RCSRemoteResourceObject.h')
109 resourceClient_env.UserInstallTargetHeader('include/RCSResourceAttributes.h', 'service/resource-encapsulation', 'RCSResourceAttributes.h')
110 resourceClient_env.UserInstallTargetHeader('include/RCSResourceObject.h', 'service/resource-encapsulation', 'RCSResourceObject.h')
111 resourceClient_env.UserInstallTargetHeader('include/RCSException.h', 'service/resource-encapsulation', 'RCSException.h')
112 resourceClient_env.UserInstallTargetHeader('include/RCSRequest.h', 'service/resource-encapsulation', 'RCSRequest.h')
113 resourceClient_env.UserInstallTargetHeader('include/RCSResponse.h', 'service/resource-encapsulation', 'RCSResponse.h')
115 ######################################################################
116 # Build Sample App: SampleResourceClient & SampleResourceServer
117 ######################################################################
118 SConscript('examples/SConscript')
120 ######################################################################
121 # Build UnitTests Resource Client , resourceCache and resourceBroker and
123 ################################################ ######################
124 if target_os in ['linux']:
125 SConscript('unittests/SConscript')
126 SConscript('src/resourceCache/unittests/SConscript')
127 SConscript('src/resourceBroker/unittest/SConscript')
129 if target_os == 'android':
130 SConscript('android/SConscript')