4a21ac5c791224e4c2f9330b38c9c535ff7581f4
[platform/upstream/iotivity.git] / service / resource-encapsulation / 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-encapsulation 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 = [
55     'include',
56     'src/common/primitiveResource/include',
57     'src/common/expiryTimer/include',
58     'src/common/utils/include',
59     'src/resourceBroker/include',
60     'src/resourceCache/include'
61 ])
62
63 resourceClient_env.PrependUnique(LIBS = ['oc', 'rcs_common', 'octbstack','oc_logger'])
64
65 if target_os not in ['windows', 'winrt']:
66     resourceClient_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
67 if target_os == 'linux':
68    resourceClient_env.AppendUnique(LIBS = ['pthread'])
69
70 if target_os == 'android':
71     resourceClient_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
72     resourceClient_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
73
74 resourceClient_env.AppendUnique(LIBS = ['dl'])
75
76 ######################################################################
77 # Source files and Targets
78 ######################################################################
79 BROKER_SRC_DIR = 'src/resourceBroker/src/'
80 CACHE_SRC_DIR = 'src/resourceCache/src/'
81 RESOURCECLIENT_DIR = 'src/resourceClient/'
82
83 client_src = [
84         BROKER_SRC_DIR + 'DeviceAssociation.cpp',
85         BROKER_SRC_DIR + 'DevicePresence.cpp',
86         BROKER_SRC_DIR + 'ResourcePresence.cpp',
87         BROKER_SRC_DIR + 'ResourceBroker.cpp',
88         CACHE_SRC_DIR + 'DataCache.cpp',
89         CACHE_SRC_DIR + 'ResourceCacheManager.cpp',
90         RESOURCECLIENT_DIR + 'RCSDiscoveryManager.cpp',
91         RESOURCECLIENT_DIR + 'RCSDiscoveryManagerImpl.cpp',
92         RESOURCECLIENT_DIR + 'RCSRemoteResourceObject.cpp'
93                 ]
94 ResourceClientsdk_static = resourceClient_env.StaticLibrary('rcs_client', client_src)
95 ResourceClientsdk_shared = resourceClient_env.SharedLibrary('rcs_client', client_src)
96
97 resourceClient_env.InstallTarget([ResourceClientsdk_static,ResourceClientsdk_shared], 'librcs_client')
98 resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static,ResourceClientsdk_shared], 'librcs_client')
99 resourceClient_env.UserInstallTargetHeader('include/RCSAddress.h', 'service/resource-encapsulation', 'RCSAddress.h')
100 resourceClient_env.UserInstallTargetHeader('include/RCSDiscoveryManager.h', 'service/resource-encapsulation', 'RCSDiscoveryManager.h')
101 resourceClient_env.UserInstallTargetHeader('include/RCSRemoteResourceObject.h', 'service/resource-encapsulation', 'RCSRemoteResourceObject.h')
102 resourceClient_env.UserInstallTargetHeader('include/RCSResourceAttributes.h', 'service/resource-encapsulation', 'RCSResourceAttributes.h')
103 resourceClient_env.UserInstallTargetHeader('include/RCSResourceObject.h', 'service/resource-encapsulation', 'RCSResourceObject.h')
104 resourceClient_env.UserInstallTargetHeader('include/RCSBundleInfo.h', 'service/resource-encapsulation', 'RCSBundleInfo.h')
105 resourceClient_env.UserInstallTargetHeader('include/RCSException.h', 'service/resource-encapsulation', 'RCSException.h')
106 resourceClient_env.UserInstallTargetHeader('include/RCSRequest.h', 'service/resource-encapsulation', 'RCSRequest.h')
107 resourceClient_env.UserInstallTargetHeader('include/RCSResourceContainer.h', 'service/resource-encapsulation', 'RCSResourceContainer.h')
108 resourceClient_env.UserInstallTargetHeader('include/RCSResponse.h', 'service/resource-encapsulation', 'RCSResponse.h')
109
110 ######################################################################
111 # Build Sample App: SampleResourceClient & SampleResourceServer
112 ######################################################################
113 SConscript('examples/SConscript')
114
115 ######################################################################
116 # Build UnitTests Resource Client , resourceCache and resourceBroker and 
117 # DiscoveryManager
118 ################################################ ######################
119 if target_os == 'linux':
120     SConscript('unittests/SConscript')
121     SConscript('src/resourceCache/unittests/SConscript')
122     SConscript('src/resourceBroker/unittest/SConscript')
123
124 if target_os == 'android':
125         SConscript('android/SConscript')