Add ResourceBroker Sconscript
[platform/upstream/iotivity.git] / service / basis / resourceBroker / 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 # ResourceBroker build script
23 ##
24
25 Import('env')
26
27 if env.get('RELEASE'):
28         env.AppendUnique(CCFLAGS = ['-Os'])
29         env.AppendUnique(CPPDEFINES = ['NDEBUG'])
30 else:
31         env.AppendUnique(CCFLAGS = ['-g'])
32
33 if env.get('LOGGING'):
34         env.AppendUnique(CPPDEFINES = ['TB_LOG'])
35
36 lib_env = env.Clone()
37 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
38 resourcebroker_env = lib_env.Clone()
39
40 target_os = env.get('TARGET_OS')
41 ######################################################################
42 # Build flags
43 ######################################################################
44 resourcebroker_env.AppendUnique(CPPPATH = ['include'])
45 resourcebroker_env.AppendUnique(CPPPATH = ['../common/primitiveResource/include'])
46 resourcebroker_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap'])
47
48 if target_os not in ['windows', 'winrt']:
49         resourcebroker_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
50
51 if target_os == 'linux':
52         resourcebroker_env.AppendUnique(LIBS = ['pthread'])
53
54 ######################################################################
55 # Source files and Targets
56 ######################################################################
57 CACHE_SRC_DIR = 'src/'
58 resourcebroker_src = [
59         CACHE_SRC_DIR + 'ResourceBroker.cpp',
60         CACHE_SRC_DIR + 'ResourcePresence.cpp',
61         CACHE_SRC_DIR + '../../common/primitiveResource/src/PrimitiveResource.cpp',
62         CACHE_SRC_DIR + '../../common/primitiveResource/src/ResourceAttributes.cpp',
63         CACHE_SRC_DIR + 'DevicePresence.cpp']
64
65 if target_os in ['tizen','android'] :
66     resourcebrokersdk = resourcebroker_env.SharedLibrary('ResourceBroker', resourcebroker_src)
67 else :
68     resourcebrokersdk = resourcebroker_env.StaticLibrary('ResourceBroker', resourcebroker_src)
69
70 resourcebroker_env.InstallTarget(resourcebrokersdk, 'libResouceBroker')
71
72 # Go to build sample apps
73 #SConscript('SampleApp/SConscript')
74