replace : iotivity -> iotivity-sec
[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 = ['src/consumer'])
49 notification_env.AppendUnique(CPPPATH = ['../../resource/csdk/stack/include'])
50 notification_env.AppendUnique(CPPPATH = ['../../resource/csdk/resource-directory/include'])
51 notification_env.AppendUnique(CPPPATH = ['../../resource/csdk/connectivity/api'])
52
53 notification_env.PrependUnique(LIBS = [
54         'octbstack',
55         'oc_logger',
56         'connectivity_abstraction',
57         'libcoap',
58         'resource_directory'
59         ])
60
61 if target_os not in ['windows', 'winrt']:
62         notification_env.AppendUnique(CCFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
63
64 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
65         notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
66
67 if target_os == 'linux':
68         notification_env.AppendUnique(LIBS = ['pthread'])
69         if not env.get('RELEASE'):
70                 notification_env.PrependUnique(LIBS = ['gcov'])
71                 notification_env.AppendUnique(CCFLAGS = ['--coverage'])
72
73 if target_os == 'android':
74         notification_env.AppendUnique(CCFLAGS = ['-frtti', '-fexceptions'])
75         notification_env.AppendUnique(LIBS = ['gnustl_shared','log'])
76
77         if not env.get('RELEASE'):
78                 notification_env.AppendUnique(LIBS = ['log'])
79
80 if target_os == 'tizen':
81         notification_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
82         # notification_env.ParseConfig('pkg-config --cflags --libs sqlite3')
83
84 if target_os == 'ios':
85         if 'CLIENT' in notification_env.get('RD_MODE'):
86                 notification_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
87
88 if env.get('WITH_CLOUD') == True:
89         notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
90
91 if env.get('SECURED') == '1':
92         notification_env.AppendUnique(CPPDEFINES = ['SECURED'])
93
94 with_mq = env.get('WITH_MQ')
95 if 'SUB' in with_mq:
96     notification_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
97     print "MQ SUB support"
98
99 if 'PUB' in with_mq:
100     notification_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
101     print "MQ PUB support"
102
103 if 'BROKER' in with_mq:
104     notification_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
105     print "MQ Broker support"
106
107
108 ######################################################################
109 # Source files and Targets
110 ######################################################################
111 notification_provider_env = notification_env.Clone()
112 notification_consumer_env = notification_env.Clone()
113
114 if target_os == 'android':
115         notification_provider_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_provider.so'])
116 if target_os == 'android':
117         notification_consumer_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libnotification_consumer.so'])
118
119 notification_common_obj = notification_provider_env.SharedObject(env.Glob('src/common/*.c'))
120
121 notification_provider_src = [
122         env.Glob('src/provider/*.c'), notification_common_obj]
123 notification_consumer_src = [
124         env.Glob('src/consumer/*.c'), notification_common_obj]
125
126 if target_os not in ['ios']:
127     providersdk = notification_provider_env.SharedLibrary('notification_provider', notification_provider_src)
128     notification_provider_env.InstallTarget(providersdk, 'libnotification_provider')
129     notification_provider_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
130     consumersdk = notification_consumer_env.SharedLibrary('notification_consumer', notification_consumer_src)
131     notification_consumer_env.InstallTarget(consumersdk, 'libnotification_consumer')
132     notification_consumer_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
133
134 providersdk = notification_provider_env.StaticLibrary('notification_provider', notification_provider_src)
135 notification_provider_env.InstallTarget(providersdk, 'libnotification_provider')
136 notification_provider_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
137
138 consumersdk = notification_consumer_env.StaticLibrary('notification_consumer', notification_consumer_src)
139 notification_consumer_env.InstallTarget(consumersdk, 'libnotification_consumer')
140 notification_consumer_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
141
142 notification_provider_env.UserInstallTargetHeader('include/NSProviderInterface.h',\
143         'service/notification', 'NSProviderInterface.h')
144 notification_consumer_env.UserInstallTargetHeader('include/NSConsumerInterface.h',\
145         'service/notification', 'NSConsumerInterface.h')
146 notification_consumer_env.UserInstallTargetHeader('include/NSCommon.h',\
147         'service/notification', 'NSCommon.h')
148
149
150 # Go to build Unit test
151 if target_os == 'linux':
152     SConscript('unittest/SConscript')
153
154 # Go to build c++ wrapper
155 SConscript('cpp-wrapper/SConscript')
156
157 if target_os == 'android':
158     SConscript('android/SConscript')
159
160 # Go to build sample apps
161 #SConscript('examples/SConscript')