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 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 samples_env = env.Clone()
24 ######################################################################
26 ######################################################################
27 samples_env.PrependUnique(CPPPATH = [
28 '../../../../logger/include',
29 '../../../../stack/include',
30 '../../../../security/include',
31 '../../../../../../extlibs/cjson',
32 '../../../../../oc_logger/include'
35 target_os = env.get('TARGET_OS')
36 if target_os not in ['windows', 'winrt']:
37 samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
39 # Note: 'pthread' is in libc for android.
40 if target_os != 'android':
41 samples_env.AppendUnique(LIBS = ['-lpthread'])
43 samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
44 samples_env.PrependUnique(LIBS = ['octbstack', 'm', 'oc_logger', 'connectivity_abstraction', 'coap'])
45 if env.get('SECURED') == '1':
46 samples_env.AppendUnique(LIBS = ['tinydtls'])
48 samples_env.Append(LINKFLAGS = ['-Wl,--no-as-needed'])
50 if target_os == 'android':
51 samples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
52 samples_env.AppendUnique(LIBS = ['gnustl_static'])
53 samples_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
55 if not env.get('RELEASE'):
56 samples_env.AppendUnique(LIBS = ['log'])
58 if target_os in ['darwin', 'ios']:
59 samples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
61 samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
63 ######################################################################
64 # Source files and Targets
65 ######################################################################
66 ocserverbasicops = samples_env.Program('ocserverbasicops', ['common.cpp', 'ocserverbasicops.cpp'])
67 occlientbasicops = samples_env.Program('occlientbasicops', ['common.cpp', 'occlientbasicops.cpp'])
68 gen_sec_bin = samples_env.Program('gen_sec_bin', ['gen_sec_bin.cpp'])
71 Alias("samples", [ocserverbasicops, occlientbasicops])
73 env.AppendTarget('samples')