Merge branch 'upstream' into tizen
[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
30 ######################################################################
31 #building Resource client, resourceBroker and resourceCache
32 ######################################################################
33
34 if env.get('RELEASE'):
35     env.AppendUnique(CCFLAGS = ['-Os'])
36     env.AppendUnique(CPPDEFINES = ['NDEBUG'])
37 else:
38     env.AppendUnique(CCFLAGS = ['-g'])
39
40 if env.get('LOGGING'):
41     env.AppendUnique(CPPDEFINES = ['TB_LOG'])
42
43 # Add third party libraries
44 lib_env = env.Clone()
45 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
46
47 resourceClient_env = lib_env.Clone()
48 target_os = env.get('TARGET_OS')
49
50 ######################################################################
51 # Build flags
52 ######################################################################
53 resourceClient_env.AppendUnique(CPPPATH = [
54     'include',
55     'src/common/primitiveResource/include',
56     'src/common/expiryTimer/include',
57     'src/common/utils/include',
58     'src/resourceBroker/include',
59     'src/resourceCache/include'
60 ])
61
62 resourceClient_env.PrependUnique(LIBS = ['oc', 'rcs_common', 'octbstack','oc_logger'])
63
64 if target_os not in ['windows', 'winrt']:
65     resourceClient_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
66 if target_os == 'linux':
67    resourceClient_env.AppendUnique(LIBS = ['pthread'])
68
69 if target_os == 'android':
70     resourceClient_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
71     resourceClient_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
72
73 resourceClient_env.AppendUnique(LIBS = ['dl'])
74
75 ######################################################################
76 # Source files and Targets
77 ######################################################################
78 BROKER_SRC_DIR = 'src/resourceBroker/src/'
79 CACHE_SRC_DIR = 'src/resourceCache/src/'
80 RESOURCECLIENT_DIR = 'src/resourceClient/'
81
82 client_src = [
83         BROKER_SRC_DIR + 'DeviceAssociation.cpp',
84         BROKER_SRC_DIR + 'DevicePresence.cpp',
85         BROKER_SRC_DIR + 'ResourcePresence.cpp',
86         BROKER_SRC_DIR + 'ResourceBroker.cpp',
87         CACHE_SRC_DIR + 'DataCache.cpp',
88         CACHE_SRC_DIR + 'ResourceCacheManager.cpp',
89         RESOURCECLIENT_DIR + 'RCSDiscoveryManager.cpp',
90         RESOURCECLIENT_DIR + 'RCSDiscoveryManagerImpl.cpp',
91         RESOURCECLIENT_DIR + 'RCSRemoteResourceObject.cpp'
92         ]
93 ResourceClientsdk_static = resourceClient_env.StaticLibrary('rcs_client', client_src)
94 ResourceClientsdk_shared = resourceClient_env.SharedLibrary('rcs_client', client_src)
95
96 resourceClient_env.InstallTarget([ResourceClientsdk_static,ResourceClientsdk_shared], 'librcs_client')
97 resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static,ResourceClientsdk_shared], 'librcs_client')
98 resourceClient_env.UserInstallTargetHeader('include/RCSAddress.h', 'iotivity-service', 'RCSAddress.h')
99 resourceClient_env.UserInstallTargetHeader('include/RCSDiscoveryManager.h', 'iotivity-service', 'RCSDiscoveryManager.h')
100 resourceClient_env.UserInstallTargetHeader('include/RCSRemoteResourceObject.h', 'iotivity-service', 'RCSRemoteResourceObject.h')
101 resourceClient_env.UserInstallTargetHeader('include/RCSResourceAttributes.h', 'iotivity-service', 'RCSResourceAttributes.h')
102 resourceClient_env.UserInstallTargetHeader('include/RCSResourceObject.h', 'iotivity-service', 'RCSResourceObject.h')
103 resourceClient_env.UserInstallTargetHeader('include/RCSException.h', 'iotivity-service', 'RCSException.h')
104 resourceClient_env.UserInstallTargetHeader('include/RCSRequest.h', 'iotivity-service', 'RCSRequest.h')
105 resourceClient_env.UserInstallTargetHeader('include/RCSResponse.h', 'iotivity-service', 'RCSResponse.h')
106
107 ######################################################################
108 # Build Sample App: SampleResourceClient & SampleResourceServer
109 ######################################################################
110 SConscript('examples/SConscript')
111
112 ######################################################################
113 # Build UnitTests Resource Client , resourceCache and resourceBroker and
114 # DiscoveryManager
115 ################################################ ######################
116 if target_os == 'linux':
117     SConscript('unittests/SConscript')
118     SConscript('src/resourceCache/unittests/SConscript')
119     SConscript('src/resourceBroker/unittest/SConscript')
120
121 if target_os == 'android':
122     SConscript('android/SConscript')