ec464347ae784ad9e1067cba63b63280fb698792
[platform/upstream/iotivity.git] / service / notification / cpp-wrapper / consumer / 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 = ['../provider/inc'])
50 notification_env.AppendUnique(CPPPATH = ['../../src/common'])
51
52 notification_env.PrependUnique(LIBS = [
53         'oc_logger',
54         'oc',
55         'notification_consumer'
56         ])
57
58 notification_env.AppendUnique(CXXFLAGS = ['-std=c++0x','-frtti'])
59
60 if target_os not in ['windows', 'winrt']:
61         notification_env.AppendUnique(CCFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
62
63 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
64         notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
65
66 if target_os == 'linux':
67         notification_env.AppendUnique(LIBS = ['pthread'])
68         
69 if target_os == 'android':
70     notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
71     notification_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
72
73 if not env.get('RELEASE'):
74     notification_env.PrependUnique(LIBS = ['gcov'])
75     notification_env.AppendUnique(CCFLAGS = ['--coverage'])
76
77 if env.get('WITH_CLOUD') == True:
78         notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
79
80 ######################################################################
81 # Source files and Targets for Consumer
82 ######################################################################
83 notification_jni_consumer_env = notification_env.Clone()
84
85 Import('notificationCommonStaticObjs')
86 Import('notificationCommonSharedObjs')
87
88 notification_consumer_src = [
89         env.Glob('src/*.cpp'),notificationCommonSharedObjs]
90
91 consumersdk = notification_env.SharedLibrary('notification_consumer_wrapper', notification_consumer_src)
92 notification_env.InstallTarget(consumersdk, 'libnotification_consumer_wrapper')
93 notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer_wrapper')
94
95 notification_consumer_src = [
96         env.Glob('src/*.cpp'),notificationCommonStaticObjs]
97
98 consumersdk = notification_env.StaticLibrary('notification_consumer_wrapper', notification_consumer_src)
99 notification_env.InstallTarget(consumersdk, 'libnotification_consumer_wrapper')
100 notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer_wrapper')
101
102 ######################################################################
103 # Source files and Targets for Consumer Jni
104 ######################################################################
105 if target_os == 'android':
106         notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../../../extlibs/boost/boost_1_58_0'])
107         notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../../../android/android_api/base/jni'])
108         notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/common'])
109         notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/consumer'])
110
111         notification_jni_consumer_env.PrependUnique(LIBS = [
112                 'notification_consumer_wrapper'
113                 ])
114
115         notification_consumer_jni_src = [
116                 env.Glob('../../android/notification-service/src/main/jni/consumer/*.cpp'),
117                 env.Glob('../../android/notification-service/src/main/jni/common/*.cpp')]
118
119         consumerJni = notification_jni_consumer_env.SharedLibrary('notification_consumer_jni', notification_consumer_jni_src)
120         notification_jni_consumer_env.InstallTarget(consumerJni, 'libnotification_consumer_jni')
121         notification_jni_consumer_env.UserInstallTargetLib(consumerJni, 'libnotification_consumer_jni')