Initial prototype for optimized Telegesis read/write layer.
[contrib/iotivity.git] / plugins / samples / linux / 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 import os
23 import os.path
24 target_os = env.get('TARGET_OS')
25 target_arch = env.get('TARGET_ARCH')
26 samples_env = env.Clone()
27 src_dir = env.get('SRC_DIR')
28 pi_dir = os.path.join(src_dir, 'plugins')
29
30 ######################################################################
31 # Build flags
32 ######################################################################
33 samples_env.PrependUnique(CPPPATH = [
34                 os.path.join(src_dir, 'resource', 'oc_logger', 'include'),
35                 os.path.join(src_dir, 'resource', 'csdk', 'logger', 'include'),
36                 os.path.join(src_dir, 'resource', 'csdk', 'stack', 'include'),
37                 os.path.join(pi_dir, 'include')
38                 ])
39
40 samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-Wextra', '-Werror'])
41 samples_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
42 samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
43
44 if target_os in ['darwin', 'ios']:
45         samples_env.PrependUnique(LIBS = ['m',
46                                           'octbstack',
47                                           'ocsrm',
48                                           'connectivity_abstraction',
49                                           'coap' ])
50 elif target_os not in ['arduino']:
51         samples_env.PrependUnique(LIBS = ['m',
52                                           'octbstack',
53                                           'ocsrm',
54                                           'connectivity_abstraction',
55                                           'coap',
56                                           'plugin_interface'])
57         samples_env.AppendUnique(LIBS = ['rt'])
58         if target_arch in ['x86_64', 'arm64']:
59                 samples_env.AppendUnique(CPPFLAGS = ['-Llib64'])
60         else:
61                 samples_env.AppendUnique(CPPFLAGS = ['-Llib'])
62         samples_env.AppendUnique(LIBS = ['pthread'])
63
64 if env.get('SECURED') == '1':
65     samples_env.AppendUnique(LIBS = ['tinydtls'])
66
67 samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
68
69 ######################################################################
70 # Source files and Targets
71 ######################################################################
72 iotivityandzigbeeserver = samples_env.Program('iotivityandzigbeeserver',
73         ['IotivityandZigbeeServer.c'])
74 iotivityandzigbeeclient = samples_env.Program('iotivityandzigbeeclient',
75         ['IotivityandZigbeeClient.c'])
76
77 list_of_samples = [iotivityandzigbeeserver, iotivityandzigbeeclient]
78
79 Alias("samples", list_of_samples)
80
81 env.AppendTarget('samples')
82
83