Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / protocol-plugin / sample-app / linux / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 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 #sample-app build script
22 ##
23 Import('env')
24
25 # Add third party libraries
26 lib_env = env.Clone()
27 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
28
29 sample_env = lib_env.Clone()
30 target_os = env.get('TARGET_OS')
31 ######################################################################
32 # Build flags
33 ######################################################################
34 sample_env.AppendUnique(CPPPATH = [
35                                 '../../plugin-manager/src/',
36                                 '../../lib/cpluff/libcpluff/',
37                                 env.get('SRC_DIR') + '/extlibs/rapidxml/'])
38
39 if target_os not in ['windows', 'winrt']:
40         sample_env.AppendUnique(CXXFLAGS = ['-Wall', '-pthread', '-std=c++0x'])
41
42 sample_env.AppendUnique(LIBS = ['oc', 'oc_logger', 'octbstack',
43                                 'connectivity_abstraction', 'coap',
44                                 'ppm', 'pmimpl', 'dl'])
45
46 if env.get('SECURED') == '1':
47     sample_env.AppendUnique(LIBS = ['tinydtls'])
48
49 # On some platforms link order can miss functions so librt needs to be
50 # re-scanned at the end if present. gcc 4.6 is one with this issue.
51 if 'rt' in sample_env.get('LIBS'):
52     sample_env.Append(LIBS = ['rt'])
53
54 sample_env.AppendUnique(LIBS = ['pthread'])
55 ######################################################################
56 # Source files and Targets
57 ######################################################################
58 mqttclient = sample_env.Program('mqtt/mqttclient', 'mqtt/mqttclient.cpp')
59
60 Command("mqtt/pluginmanager.xml","../../plugin-manager/src/pluginmanager.xml", Copy("$TARGET", "$SOURCE"))
61 Command("mqtt/libpmimpl.so","../../../../libpmimpl.so", Copy("$TARGET", "$SOURCE"))
62
63 Alias('mqttclient', mqttclient)
64 env.AppendTarget('mqttclient')