replace : iotivity -> iotivity-sec
[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 target_os = env.get('TARGET_OS')
44
45 if target_os in ['ios']:
46     env.AppendUnique(CPPDEFINES = ['TARGET_OS_IPHONE'])
47
48 # Add third party libraries
49 lib_env = env.Clone()
50 SConscript('#service/third_party_libs.scons', 'lib_env')
51
52 resourceClient_env = lib_env.Clone()
53
54 ######################################################################
55 # Build flags
56 ######################################################################
57 resourceClient_env.AppendUnique(CPPPATH = [
58     'include',
59     'src/common/primitiveResource/include',
60     'src/common/expiryTimer/include',
61     'src/common/utils/include',
62     'src/resourceBroker/include',
63     'src/resourceCache/include'
64 ])
65
66 resourceClient_env.PrependUnique(LIBS = ['oc', 'rcs_common', 'octbstack','oc_logger'])
67
68 if target_os not in ['windows']:
69     resourceClient_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
70     resourceClient_env.AppendUnique(LIBS = ['dl'])
71     if target_os in ['linux']:
72         resourceClient_env.AppendUnique(LIBS = ['pthread'])
73
74 if target_os in ['android']:
75     resourceClient_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
76     resourceClient_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
77
78 if target_os in ['linux']:
79     if not env.get('RELEASE'):
80         resourceClient_env.PrependUnique(LIBS = ['gcov'])
81         resourceClient_env.AppendUnique(CXXFLAGS = ['--coverage'])
82
83 ######################################################################
84 # Source files and Targets
85 ######################################################################
86 BROKER_SRC_DIR = 'src/resourceBroker/src/'
87 CACHE_SRC_DIR = 'src/resourceCache/src/'
88 RESOURCECLIENT_DIR = 'src/resourceClient/'
89
90 client_src = [
91         BROKER_SRC_DIR + 'DeviceAssociation.cpp',
92         BROKER_SRC_DIR + 'DevicePresence.cpp',
93         BROKER_SRC_DIR + 'ResourcePresence.cpp',
94         BROKER_SRC_DIR + 'ResourceBroker.cpp',
95         CACHE_SRC_DIR + 'DataCache.cpp',
96         CACHE_SRC_DIR + 'ResourceCacheManager.cpp',
97         CACHE_SRC_DIR + 'ObserveCache.cpp',
98         RESOURCECLIENT_DIR + 'RCSDiscoveryManager.cpp',
99         RESOURCECLIENT_DIR + 'RCSDiscoveryManagerImpl.cpp',
100         RESOURCECLIENT_DIR + 'RCSRemoteResourceObject.cpp'
101         ]
102 ResourceClientsdk_static = resourceClient_env.StaticLibrary('rcs_client', client_src)
103 if target_os not in ['ios']:
104     ResourceClientsdk_shared = resourceClient_env.SharedLibrary('rcs_client', client_src)
105     resourceClient_env.InstallTarget([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
106     resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
107 else:
108     resourceClient_env.InstallTarget([ResourceClientsdk_static], 'rcs_client')
109     resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static], 'rcs_client')
110 resourceClient_env.UserInstallTargetHeader('include/RCSAddress.h', 'service/resource-encapsulation', 'RCSAddress.h')
111 resourceClient_env.UserInstallTargetHeader('include/RCSDiscoveryManager.h', 'service/resource-encapsulation', 'RCSDiscoveryManager.h')
112 resourceClient_env.UserInstallTargetHeader('include/RCSRemoteResourceObject.h', 'service/resource-encapsulation', 'RCSRemoteResourceObject.h')
113 resourceClient_env.UserInstallTargetHeader('include/RCSResourceAttributes.h', 'service/resource-encapsulation', 'RCSResourceAttributes.h')
114 resourceClient_env.UserInstallTargetHeader('include/RCSResourceObject.h', 'service/resource-encapsulation', 'RCSResourceObject.h')
115 resourceClient_env.UserInstallTargetHeader('include/RCSException.h', 'service/resource-encapsulation', 'RCSException.h')
116 resourceClient_env.UserInstallTargetHeader('include/RCSRequest.h', 'service/resource-encapsulation', 'RCSRequest.h')
117 resourceClient_env.UserInstallTargetHeader('include/RCSResponse.h', 'service/resource-encapsulation', 'RCSResponse.h')
118 resourceClient_env.UserInstallTargetHeader('include/RCSRepresentation.h', 'service/resource-encapsulation', 'RCSRepresentation.h')
119 resourceClient_env.UserInstallTargetHeader('include/RCSSeparateResponse.h', 'service/resource-encapsulation', 'RCSSeparateResponse.h')
120
121 ######################################################################
122 # Build Sample App: SampleResourceClient & SampleResourceServer
123 ######################################################################
124 #SConscript('examples/SConscript')
125
126 ######################################################################
127 # Build UnitTests Resource Client , resourceCache and resourceBroker and 
128 # DiscoveryManager
129 ################################################ ######################
130 if target_os in ['linux']:
131     SConscript('unittests/SConscript')
132     SConscript('src/resourceCache/unittests/SConscript')
133     SConscript('src/resourceBroker/unittest/SConscript')
134
135 if target_os == 'android':
136     SConscript('android/SConscript')