0840ef36fc1d44d34b6aa324c999aad4b38b3b8b
[platform/upstream/iotivity.git] / examples / OICMiddle / 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 ##
22 # Examples build script
23 ##
24 Import('env')
25 # Add third party libraries
26 lib_env = env.Clone()
27 SConscript('#resource/third_party_libs.scons', 'lib_env')
28
29 examples_env = lib_env.Clone()
30
31 ######################################################################
32 # Build flags
33 ######################################################################
34 examples_env.AppendUnique(CPPPATH = [
35                 '../../resource/include/',
36                 '../../resource/csdk/stack/include',
37                 '../../resource/c_common/ocrandom/include',
38                 '../../resource/csdk/logger/include',
39                 '../../resource/oc_logger/include'
40                 ])
41
42 target_os = env.get('TARGET_OS')
43 if target_os not in ['windows', 'winrt']:
44         examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
45
46         # Note: 'pthread' is in libc for android. On other platform, if use
47         # new gcc(>4.9?) it isn't required, otherwise, it's required
48         if target_os != 'android':
49                 examples_env.AppendUnique(LIBS = ['pthread'])
50
51 examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
52 examples_env.PrependUnique(LIBS = ['coap'])
53 examples_env.AppendUnique(LIBS = ['connectivity_abstraction'])
54 examples_env.AppendUnique(LIBS = ['oc_logger'])
55 examples_env.AppendUnique(LIBS = ['octbstack'])
56 examples_env.AppendUnique(LIBS = ['oc'])
57 examples_env.AppendUnique(LIBS = ['rt'])
58
59 if env.get('SECURED') == '1':
60     examples_env.AppendUnique(LIBS = ['tinydtls'])
61
62 if target_os == 'android':
63         examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
64         examples_env.AppendUnique(LIBS = ['gnustl_static'])
65
66         if not env.get('RELEASE'):
67                 examples_env.AppendUnique(LIBS = ['log'])
68
69 if target_os in ['darwin', 'ios']:
70         examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
71
72 ######################################################################
73 # Source files and Targets
74 ######################################################################
75 OICMiddle = examples_env.Program('OICMiddle', ['OICMiddle.cpp', 'Client.cpp', 'LineInput.cpp', 'RestInput.cpp', 'Server.cpp', 'WrapResource.cpp'])
76
77 Alias("examples", [OICMiddle])
78 env.AppendTarget('examples')
79
80
81