replace : iotivity -> iotivity-sec
[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 thread_env = SConscript('#build_common/thread.scons')
22 samples_env = thread_env.Clone()
23 target_os = samples_env.get('TARGET_OS')
24 with_ra = samples_env.get ('WITH_RA')
25
26 ######################################################################
27 # Build flags
28 ######################################################################
29 with_upstream_libcoap = samples_env.get('WITH_UPSTREAM_LIBCOAP')
30 if with_upstream_libcoap == '1':
31         # For bring up purposes only, we manually copy the forked version to where the unforked version is downloaded.
32         samples_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
33 else:
34         # For bring up purposes only, the forked version will live here.
35         samples_env.AppendUnique(CPPPATH = ['../../../../../connectivity/lib/libcoap-4.1.1/include'])
36
37 samples_env.PrependUnique(CPPPATH = [
38                 '../../../../logger/include',
39                 '../../../../stack/include',
40                 '../../../../security/include',
41                 '../../../../../../extlibs/cjson',
42                 '../../../../../../extlibs/boost/boost',
43                 '../../../../../oc_logger/include',
44                 ])
45
46 compiler = samples_env.get('CXX')
47 if 'g++' in compiler:
48         samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
49
50 samples_env.AppendUnique(RPATH = [samples_env.get('BUILD_DIR')])
51 samples_env.AppendUnique(LIBPATH = [samples_env.get('BUILD_DIR')])
52
53 samples_env.PrependUnique(LIBS = ['octbstack', 'ocsrm', 'connectivity_abstraction', 'coap'])
54
55 if target_os not in ['arduino', 'windows', 'darwin', 'ios', 'msys_nt']:
56         samples_env.AppendUnique(LIBS = ['rt'])
57
58 if target_os not in ['windows']:
59         samples_env.PrependUnique(LIBS = ['m'])
60
61 samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
62
63 ######################################################################
64 # Source files and Targets
65 ######################################################################
66 ocserver         = samples_env.Program('ocserver', ['ocserver.cpp', 'common.cpp'])
67 if samples_env.get('ROUTING') == 'GW':
68         ocrouting        = samples_env.Program('ocrouting', ['ocrouting.cpp', 'common.cpp'])
69 occlient         = samples_env.Program('occlient', ['occlient.cpp', 'common.cpp'])
70 ocserverslow     = samples_env.Program('ocserverslow', ['ocserverslow.cpp', 'common.cpp'])
71 occlientslow     = samples_env.Program('occlientslow', ['occlientslow.cpp', 'common.cpp'])
72 ocservercoll     = samples_env.Program('ocservercoll', ['ocservercoll.cpp', 'common.cpp'])
73 occlientcoll     = samples_env.Program('occlientcoll', ['occlientcoll.cpp', 'common.cpp'])
74 ocserverbasicops = samples_env.Program('ocserverbasicops', ['ocserverbasicops.cpp', 'common.cpp'])
75 occlientbasicops = samples_env.Program('occlientbasicops', ['occlientbasicops.cpp', 'common.cpp'])
76 if with_ra:
77         ocremoteaccessclient = samples_env.Program('ocremoteaccessclient',
78                                                 ['ocremoteaccessclient.cpp','common.cpp'])
79
80 list_of_samples = [ocserver, occlient,
81                                 ocservercoll, occlientcoll,
82                                 ocserverbasicops, occlientbasicops,
83                                 ocserverslow, occlientslow
84                 ]
85 if with_ra:
86         list_of_samples.append (ocremoteaccessclient)
87 Alias("samples", list_of_samples)
88
89 samples_env.AppendTarget('samples')
90
91