replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / cpp-wrapper / provider / 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 c++ wrapper 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 ######################################################################
44 # Build flags
45 ######################################################################
46 notification_env.AppendUnique(CPPPATH = ['../../include'])
47 notification_env.AppendUnique(CPPPATH = ['inc'])
48 notification_env.AppendUnique(CPPPATH = ['../common'])
49 notification_env.AppendUnique(CPPPATH = ['../consumer/inc'])
50 notification_env.AppendUnique(CPPPATH = ['../../src/common'])
51
52 notification_env.PrependUnique(LIBS = [
53         'oc_logger',
54         'oc',
55         'octbstack',
56         'notification_provider',
57         'resource_directory'
58         ])
59 notification_env.AppendUnique(CXXFLAGS = ['-std=c++0x','-frtti'])
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         
70 if target_os == 'android':
71     notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
72     notification_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
73
74 if not env.get('RELEASE') and target_os not in ['ios']:
75     notification_env.PrependUnique(LIBS = ['gcov'])
76     notification_env.AppendUnique(CCFLAGS = ['--coverage'])
77
78 if env.get('WITH_CLOUD') == True:
79         notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
80
81 with_mq = env.get('WITH_MQ')
82 if 'SUB' in with_mq:
83     notification_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
84     print "MQ SUB support"
85
86 if 'PUB' in with_mq:
87     notification_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
88     print "MQ PUB support"
89
90 if 'BROKER' in with_mq:
91     notification_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
92     print "MQ Broker support"
93 ######################################################################
94 # Source files and Targets for Provider
95 ######################################################################
96 notification_jni_provider_env = notification_env.Clone()
97
98 notificationCommonStaticObjs = [
99         notification_env.Object('../common/NSMediaContents.cpp'),
100         notification_env.Object('../common/NSMessage.cpp'),
101         notification_env.Object('../common/NSSyncInfo.cpp'),
102         notification_env.Object('../common/NSTopic.cpp'),
103         notification_env.Object('../common/NSTopicsList.cpp')]
104
105 notificationCommonSharedObjs = [
106         notification_env.SharedObject('../common/NSMediaContents.cpp'),
107         notification_env.SharedObject('../common/NSMessage.cpp'),
108         notification_env.SharedObject('../common/NSSyncInfo.cpp'),
109         notification_env.SharedObject('../common/NSTopic.cpp'),
110         notification_env.SharedObject('../common/NSTopicsList.cpp')]
111
112 notification_provider_src = [
113         env.Glob('src/*.cpp'),notificationCommonSharedObjs]
114
115 if target_os not in ['ios']:
116         providersdk = notification_env.SharedLibrary('notification_provider_wrapper', notification_provider_src)
117         notification_env.InstallTarget(providersdk, 'libnotification_provider_wrapper')
118         notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider_wrapper')
119
120 notification_provider_src = [
121         env.Glob('src/*.cpp'),notificationCommonStaticObjs]
122
123 providersdk = notification_env.StaticLibrary('notification_provider_wrapper', notification_provider_src)
124 notification_env.InstallTarget(providersdk, 'libnotification_provider_wrapper')
125 notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider_wrapper')
126 notification_env.UserInstallTargetHeader('inc/NSConsumer.h', 'service/notification', 'NSConsumer.h')
127 notification_env.UserInstallTargetHeader('inc/NSProviderService.h', 'service/notification', 'NSProviderService.h')
128
129 Export('notificationCommonStaticObjs')
130 Export('notificationCommonSharedObjs')
131
132 ######################################################################
133 # Source files and Targets for Provider Jni
134 ######################################################################
135 if target_os == 'android':
136         notification_jni_provider_env.AppendUnique(CPPPATH = ['../../../../extlibs/boost/boost_1_58_0'])
137         notification_jni_provider_env.AppendUnique(CPPPATH = ['../../../../android/android_api/base/jni'])
138         notification_jni_provider_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/common'])
139         notification_jni_provider_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/provider'])
140
141         notification_jni_provider_env.PrependUnique(LIBS = [
142                 'notification_provider_wrapper'
143                 ])
144
145         notificationJniCommonSharedObjs = [
146                 notification_jni_provider_env.SharedObject('../../android/notification-service/src/main/jni/common/JniNotificationCommon.cpp')]
147
148         notification_provider_jni_src = [
149                 env.Glob('../../android/notification-service/src/main/jni/provider/*.cpp'),
150                 notificationJniCommonSharedObjs]
151
152         providerJni = notification_jni_provider_env.SharedLibrary('notification_provider_jni', notification_provider_jni_src)
153         notification_jni_provider_env.InstallTarget(providerJni, 'libnotification_provider_jni')
154         notification_jni_provider_env.UserInstallTargetLib(providerJni, 'libnotification_provider_jni')
155
156         Export('notificationJniCommonSharedObjs')