Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / service / notification / cpp-wrapper / examples / linux / 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 build script
23 ##
24
25 Import('env')
26
27 lib_env = env.Clone()
28 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
29 notification_sample_env = lib_env.Clone()
30
31 target_os = env.get('TARGET_OS')
32 ######################################################################
33 # Build flags
34 ######################################################################
35 notification_sample_env.AppendUnique(CPPPATH = ['../../../include'])
36 notification_sample_env.AppendUnique(CPPPATH = ['../../provider/inc'])
37 notification_sample_env.AppendUnique(CPPPATH = ['../../consumer/inc'])
38 notification_sample_env.AppendUnique(CPPPATH = ['../../common'])
39 notification_sample_env.AppendUnique(CPPPATH = ['../../../../../resource/csdk/stack/include'])
40 notification_sample_env.AppendUnique(CPPPATH = ['../../../../../resource/csdk/connectivity/api'])
41 notification_sample_env.AppendUnique(CPPPATH = ['../../../src/common'])
42
43 notification_sample_env.PrependUnique(LIBS = [
44         'liboctbstack',
45         'oc_logger',
46         'oc',
47         'connectivity_abstraction',
48         'libcoap',
49         'resource_directory'
50         ])
51
52 notification_sample_env.AppendUnique(CXXFLAGS = ['-std=c++0x','-frtti'])
53 if target_os not in ['windows', 'winrt']:
54         notification_sample_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
55
56 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
57         notification_sample_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
58
59 if target_os == 'linux':
60         notification_sample_env.AppendUnique(LIBS = ['pthread'])
61
62 if target_os == 'android':
63         notification_sample_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
64         notification_sample_env.AppendUnique(LIBS = ['gnustl_shared','log'])
65
66 if not env.get('RELEASE'):
67     notification_sample_env.PrependUnique(LIBS = ['gcov'])
68     notification_sample_env.AppendUnique(CCFLAGS = ['--coverage'])
69
70 if env.get('WITH_CLOUD') == True:
71         notification_sample_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
72
73 with_mq = env.get('WITH_MQ')
74 if 'SUB' in with_mq:
75     notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
76     print("MQ SUB support")
77
78 if 'PUB' in with_mq:
79     notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
80     print("MQ PUB support")
81
82 if 'BROKER' in with_mq:
83     notification_sample_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
84     print("MQ Broker support")
85
86 if env.get('WITH_TCP') == True:
87         notification_sample_env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
88 if env.get('SECURED') == '1':
89         notification_sample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
90
91 ####################################################################
92 # Source files and Targets
93 ######################################################################
94 notification_sample_provider_env = notification_sample_env.Clone()
95
96 notification_sample_provider_env.AppendUnique(LIBS = 'libnotification_provider_wrapper')
97 notification_sample_provider_env.AppendUnique(LIBS = 'libnotification_provider')
98 notificationproviderwrapper = notification_sample_provider_env.Program('notificationproviderwrapper', 'notificationserviceprovider.cpp')
99 i_notificationprovider = notification_sample_provider_env.Install(env.get('BUILD_DIR'), notificationproviderwrapper)
100
101 notification_sample_consumer_env = notification_sample_env.Clone()
102 notification_sample_consumer_env.AppendUnique(LIBS = 'libnotification_consumer_wrapper')
103 notification_sample_consumer_env.AppendUnique(LIBS = 'libnotification_consumer')
104 notificationconsumerwrapper = notification_sample_consumer_env.Program('notificationconsumerwrapper', 'notificationserviceconsumer.cpp')
105 i_notificationconsumer = notification_sample_consumer_env.Install(env.get('BUILD_DIR'), notificationconsumerwrapper)