Imported Upstream version 0.9.1
[platform/upstream/iotivity.git] / service / notification-manager / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 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 # NotificationManager 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 = ['-DTB_LOG'])
35
36 lib_env = env.Clone()
37 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
38 notimgr_env = lib_env.Clone()
39
40 target_os = env.get('TARGET_OS')
41 ######################################################################
42 # Build flags
43 ######################################################################
44 notimgr_env.AppendUnique(CPPPATH = ['NotificationManager/include'])
45 notimgr_env.AppendUnique(CPPPATH = ['../../extlibs/cjson'])
46 notimgr_env.AppendUnique(CPPPATH = ['../../resource/csdk/logger/include'])
47 notimgr_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap'])
48
49 if target_os not in ['windows', 'winrt']:
50         notimgr_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
51
52 if target_os == 'linux':
53         notimgr_env.AppendUnique(LIBS = ['pthread'])
54
55 if target_os == 'android':
56         notimgr_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
57         notimgr_env.AppendUnique(LIBS = ['gnustl_shared','log'])
58
59         if not env.get('RELEASE'):
60                 notimgr_env.AppendUnique(LIBS = ['log'])
61
62 ######################################################################
63 # Source files and Targets
64 ######################################################################
65 NOTI_SRC_DIR = 'NotificationManager/src/'
66 notimgr_src = [
67         NOTI_SRC_DIR + 'hosting.c',
68         NOTI_SRC_DIR + 'requestHandler.c',
69         NOTI_SRC_DIR + 'virtualResource.c']
70
71 if target_os == 'android':
72         notimgr_src.append(NOTI_SRC_DIR + 'resourceCoordinator_JNI.cpp')
73
74 if target_os in ['tizen','android'] :
75     notificationsdk = notimgr_env.SharedLibrary('NotificationManager', notimgr_src)
76 else :
77     notificationsdk = notimgr_env.StaticLibrary('NotificationManager', notimgr_src)
78
79 notimgr_env.InstallTarget(notificationsdk, 'libResouceHosting')
80
81 # Go to build sample apps
82 SConscript('SampleApp/SConscript')
83