1 #******************************************************************
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 Import('stacksamples_env')
23 samples_env = stacksamples_env.Clone()
24 SConscript('#build_common/thread.scons', exports={'thread_env': samples_env})
26 target_os = samples_env.get('TARGET_OS')
27 with_ra = samples_env.get('WITH_RA')
29 ######################################################################
31 ######################################################################
32 with_upstream_libcoap = samples_env.get('WITH_UPSTREAM_LIBCOAP')
33 if with_upstream_libcoap == '1':
34 # For bring up purposes only, we manually copy the forked version to where
35 # the unforked version is downloaded.
36 samples_env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
38 # For bring up purposes only, the forked version will live here.
39 samples_env.AppendUnique(
40 CPPPATH=['../../../../../connectivity/lib/libcoap-4.1.1/include'])
42 samples_env.PrependUnique(CPPPATH=[
43 '../../../../logger/include',
44 '../../../../include',
45 '../../../../stack/include',
46 '../../../../security/include',
47 '../../../../../../extlibs/boost/boost',
48 '../../../../../oc_logger/include',
51 compiler = samples_env.get('CXX')
53 samples_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall'])
55 samples_env.AppendUnique(RPATH=[samples_env.get('BUILD_DIR')])
56 samples_env.AppendUnique(LIBPATH=[samples_env.get('BUILD_DIR')])
58 samples_env.PrependUnique(
59 LIBS=['octbstack', 'ocsrm', 'connectivity_abstraction', 'coap'])
61 if target_os not in ['arduino', 'windows', 'darwin', 'ios', 'msys_nt']:
62 samples_env.AppendUnique(LIBS=['rt'])
64 if target_os not in ['windows']:
65 samples_env.PrependUnique(LIBS=['m'])
67 if samples_env.get('SECURED') == '1':
68 samples_env.AppendUnique(LIBS=['mbedtls'])
70 samples_env.AppendUnique(LIBS = ['timer'])
72 samples_env.AppendUnique(CPPDEFINES=['TB_LOG'])
74 src_dir = samples_env.get('SRC_DIR')
75 sample_src_dir = src_dir + '/resource/csdk/stack/samples/linux/SimpleClientServer/'
76 sample_build_dir = samples_env.get(
77 'BUILD_DIR') + '/resource/csdk/stack/samples/linux/SimpleClientServer/'
80 introspectionJson = samples_env.Install(sample_build_dir,
81 sample_src_dir + 'introspection.json')
83 deviceProperties = samples_env.Install(sample_build_dir,
84 sample_src_dir + 'device_properties.dat')
87 ######################################################################
88 # Source files and Targets
89 ######################################################################
90 ocserver = samples_env.Program('ocserver', ['ocserver.cpp', 'common.cpp'])
91 if samples_env.get('ROUTING') == 'GW':
92 ocrouting = samples_env.Program(
93 'ocrouting', ['ocrouting.cpp', 'common.cpp'])
94 occlient = samples_env.Program('occlient', ['occlient.cpp', 'common.cpp'])
95 ocserverslow = samples_env.Program(
96 'ocserverslow', ['ocserverslow.cpp', 'common.cpp'])
97 occlientslow = samples_env.Program(
98 'occlientslow', ['occlientslow.cpp', 'common.cpp'])
99 ocservercoll = samples_env.Program(
100 'ocservercoll', ['ocservercoll.cpp', 'common.cpp'])
101 occlientcoll = samples_env.Program(
102 'occlientcoll', ['occlientcoll.cpp', 'common.cpp'])
103 ocserverbasicops = samples_env.Program(
104 'ocserverbasicops', ['ocserverbasicops.cpp', 'common.cpp'])
105 occlientbasicops = samples_env.Program(
106 'occlientbasicops', ['occlientbasicops.cpp', 'common.cpp'])
108 ocremoteaccessclient = samples_env.Program('ocremoteaccessclient',
109 ['ocremoteaccessclient.cpp', 'common.cpp'])
111 list_of_samples = [ocserver, occlient,
112 ocservercoll, occlientcoll,
113 ocserverbasicops, occlientbasicops,
114 ocserverslow, occlientslow
117 list_of_samples.append(ocremoteaccessclient)
118 Alias("samples", list_of_samples)
120 samples_env.AppendTarget('samples')