added cacheadapter interface and memorycache 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 if target_os == 'linux':
52     notification_env.AppendUnique(CPPPATH = ['src/provider/cache/linux'])
53
54 if target_os == 'android':
55     notification_env.AppendUnique(CPPPATH = ['src/provider/cache/android'])
56
57 notification_env.PrependUnique(LIBS = [
58         'octbstack',
59         'oc_logger',
60         'connectivity_abstraction',
61         'libcoap'
62         ])
63
64 if target_os not in ['windows', 'winrt']:
65         notification_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
66
67 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
68         notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
69
70 if target_os == 'linux':
71         notification_env.AppendUnique(LIBS = ['pthread'])
72
73 if target_os == 'android':
74         notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
75         notification_env.AppendUnique(LIBS = ['gnustl_shared','log'])
76         notification_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_provider.so'])
77
78
79         if not env.get('RELEASE'):
80                 notification_env.AppendUnique(LIBS = ['log'])
81
82 ######################################################################
83 # Source files and Targets
84 ######################################################################
85
86 if target_os == 'linux':
87     PROVIDER_CACHE = File('src/provider/cache/linux/NSProviderMemoryCache.c')
88
89 if target_os == 'android':
90     PROVIDER_CACHE = File('src/provider/cache/linux/NSProviderMemoryCache.c')
91
92 notification_provider_src = [
93         env.Glob('src/provider/*.c'),
94         env.Glob('src/common/*.c'), PROVIDER_CACHE]
95 notification_consumer_src = [
96         env.Glob('src/common/*.c'),
97         env.Glob('src/consumer/*.c')]
98
99 providersdk = notification_env.SharedLibrary('notification_provider', notification_provider_src)
100 notification_env.InstallTarget(providersdk, 'libnotification_provider')
101 notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
102
103 consumersdk = notification_env.SharedLibrary('notification_consumer', notification_consumer_src)
104 notification_env.InstallTarget(consumersdk, 'libnotification_consumer')
105 notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
106
107 providersdk = notification_env.StaticLibrary('notification_provider', notification_provider_src)
108 notification_env.InstallTarget(providersdk, 'libnotification_provider')
109 notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
110
111 consumersdk = notification_env.StaticLibrary('notification_consumer', notification_consumer_src)
112 notification_env.InstallTarget(consumersdk, 'libnotification_consumer')
113 notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
114
115 #notification_env.UserInstallTargetHeader('include/NSProviderIngerface.h',\
116 #       'service/notification', 'NSProviderIngerface.h')
117 #notification_env.UserInstallTargetHeader('include/NSConsumerIngerface.h',\
118 #       'service/notification', 'NSConsumerIngerface.h')
119
120 # Go to build Unit test
121 #if target_os == 'linux':
122 #       SConscript('unittest/SConscript')
123
124 # Go to build sample apps
125 SConscript('examples/SConscript')
126
127 # Go to build jni
128 if target_os == 'android':
129     SConscript('android/SConscript')