Merge branch 'master' into windows-port
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / linux / SimpleClientServer / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 Intel Mobile Communications GmbH 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 Import('env')
22 target_os = env.get('TARGET_OS')
23 samples_env = env.Clone()
24 with_ra = env.get ('WITH_RA')
25 ######################################################################
26 # Build flags
27 ######################################################################
28 samples_env.PrependUnique(CPPPATH = [
29                 '../../../../logger/include',
30                 '../../../../stack/include',
31                 '../../../../../../extlibs/cjson',
32                 '../../../../../../extlibs/boost',
33                 '../../../../../oc_logger/include',
34                 '../../../../../connectivity/lib/libcoap-4.1.1'
35                 ])
36
37 cc = env.get('CC')
38 if cc in ['gcc']:
39         samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
40         samples_env.AppendUnique(LIBS=['-lpthread'])
41 samples_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
42 samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
43
44 samples_env.PrependUnique(LIBS = ['octbstack', 'ocsrm', 'connectivity_abstraction', 'coap'])
45
46 if target_os not in ['arduino', 'windows', 'darwin', 'ios', 'msys_nt']:
47         samples_env.AppendUnique(LIBS = ['rt'])
48
49 if target_os not in ['windows']:
50         samples_env.PrependUnique(LIBS = ['m'])
51
52 if env.get('SECURED') == '1':
53     samples_env.AppendUnique(LIBS = ['tinydtls'])
54
55 samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
56
57 ######################################################################
58 # Source files and Targets
59 ######################################################################
60 ocserver         = samples_env.Program('ocserver', ['ocserver.cpp', 'common.cpp'])
61 if samples_env.get('ROUTING') == 'GW':
62         ocrouting        = samples_env.Program('ocrouting', ['ocrouting.cpp', 'common.cpp'])
63 occlient         = samples_env.Program('occlient', ['occlient.cpp', 'common.cpp'])
64 ocserverslow     = samples_env.Program('ocserverslow', ['ocserverslow.cpp', 'common.cpp'])
65 occlientslow     = samples_env.Program('occlientslow', ['occlientslow.cpp', 'common.cpp'])
66 ocservercoll     = samples_env.Program('ocservercoll', ['ocservercoll.cpp', 'common.cpp'])
67 occlientcoll     = samples_env.Program('occlientcoll', ['occlientcoll.cpp', 'common.cpp'])
68 ocserverbasicops = samples_env.Program('ocserverbasicops', ['ocserverbasicops.cpp', 'common.cpp'])
69 occlientbasicops = samples_env.Program('occlientbasicops', ['occlientbasicops.cpp', 'common.cpp'])
70 if with_ra:
71         ocremoteaccessclient = samples_env.Program('ocremoteaccessclient',
72                                                 ['ocremoteaccessclient.cpp','common.cpp'])
73
74 list_of_samples = [ocserver, occlient,
75                                 ocservercoll, occlientcoll,
76                                 ocserverbasicops, occlientbasicops,
77                                 ocserverslow, occlientslow
78                 ]
79 if with_ra:
80         list_of_samples.append (ocremoteaccessclient)
81 Alias("samples", list_of_samples)
82
83 env.AppendTarget('samples')
84
85