Added Initial version of notification.
[platform/upstream/iotivity.git] / service / notification / SConscript
1 #******************************************************************
2 #
3 # Copyright 2016 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 # Notification Service build script
23 ##
24
25 import platform
26 Import('env')
27
28 if env.get('RELEASE'):
29         env.AppendUnique(CCFLAGS = ['-Os'])
30         env.AppendUnique(CPPDEFINES = ['NDEBUG'])
31 else:
32         env.AppendUnique(CCFLAGS = ['-g'])
33
34 if env.get('LOGGING'):
35         env.AppendUnique(CPPDEFINES = ['TB_LOG'])
36
37 lib_env = env.Clone()
38 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
39 notification_env = lib_env.Clone()
40
41 target_os = env.get('TARGET_OS')
42 ######################################################################
43 # Build flags
44 ######################################################################
45 notification_env.AppendUnique(CPPPATH = ['include'])
46 notification_env.AppendUnique(CPPPATH = ['src/common'])
47 notification_env.AppendUnique(CPPPATH = ['src/provider'])
48 notification_env.AppendUnique(CPPPATH = ['../../resource/csdk/stack/include'])
49 notification_env.AppendUnique(CPPPATH = ['../../resource/csdk/connectivity/api'])
50
51 notification_env.PrependUnique(LIBS = [
52         'octbstack',
53         'oc_logger',
54         'connectivity_abstraction',
55         'libcoap'
56         ])
57
58 if target_os not in ['windows', 'winrt']:
59         notification_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
60
61 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
62         notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
63
64 if target_os == 'linux':
65         notification_env.AppendUnique(LIBS = ['pthread'])
66
67 if target_os == 'android':
68         notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
69         notification_env.AppendUnique(LIBS = ['gnustl_shared','log'])
70         notification_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_provider.so'])
71
72
73         if not env.get('RELEASE'):
74                 notification_env.AppendUnique(LIBS = ['log'])
75
76 ######################################################################
77 # Source files and Targets
78 ######################################################################
79 notification_provider_src = [
80         env.Glob('src/provider/*.c'),
81         env.Glob('src/common/*.c')]
82 notification_consumer_src = [
83         #env.Glob('src/common/*.c'),
84         env.Glob('src/consumer/*.c')]
85
86 providersdk = notification_env.SharedLibrary('notification_provider', notification_provider_src)
87 notification_env.InstallTarget(providersdk, 'libnotification_provider')
88 notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
89
90 consumersdk = notification_env.SharedLibrary('notification_consumer', notification_consumer_src)
91 notification_env.InstallTarget(consumersdk, 'libnotification_consumer')
92 notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
93
94 providersdk = notification_env.StaticLibrary('notification_provider', notification_provider_src)
95 notification_env.InstallTarget(providersdk, 'libnotification_provider')
96 notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
97
98 consumersdk = notification_env.StaticLibrary('notification_consumer', notification_consumer_src)
99 notification_env.InstallTarget(consumersdk, 'libnotification_consumer')
100 notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
101
102 #notification_env.UserInstallTargetHeader('include/NSProviderIngerface.h',\
103 #       'service/notification', 'NSProviderIngerface.h')
104 #notification_env.UserInstallTargetHeader('include/NSConsumerIngerface.h',\
105 #       'service/notification', 'NSConsumerIngerface.h')
106
107 # Go to build Unit test
108 #if target_os == 'linux':
109 #       SConscript('unittest/SConscript')
110
111 # Go to build sample apps
112 SConscript('examples/SConscript')
113
114 # Go to build jni
115 if target_os == 'android':
116     SConscript('android/SConscript')