1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
Import('env')
samples_env = env.Clone()
######################################################################
# Build flags
######################################################################
samples_env.PrependUnique(CPPPATH = [
'../../../../ocsocket/include',
'../../../../logger/include',
'../../../../stack/include',
'../../../../security/include',
'../../../../../../extlibs/cjson',
'../../../../../oc_logger/include'
])
target_os = env.get('TARGET_OS')
if target_os not in ['windows', 'winrt']:
samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
# Note: 'pthread' is in libc for android.
if target_os != 'android':
samples_env.AppendUnique(LIBS = ['-lpthread'])
samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
samples_env.PrependUnique(LIBS = ['octbstack', 'm', 'oc_logger', 'connectivity_abstraction', 'coap'])
if env.get('SECURED') == '1':
samples_env.AppendUnique(LIBS = ['tinydtls'])
samples_env.Append(LINKFLAGS = ['-Wl,--no-as-needed'])
samples_env.ParseConfig('pkg-config --libs glib-2.0');
if target_os == 'android':
samples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
samples_env.AppendUnique(LIBS = ['gnustl_static'])
samples_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
if not env.get('RELEASE'):
samples_env.AppendUnique(LIBS = ['log'])
if target_os in ['darwin', 'ios']:
samples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
######################################################################
# Source files and Targets
######################################################################
ocserverbasicops = samples_env.Program('ocserverbasicops', ['common.cpp', 'ocserverbasicops.cpp'])
occlientbasicops = samples_env.Program('occlientbasicops', ['common.cpp', 'occlientbasicops.cpp'])
gen_sec_bin = samples_env.Program('gen_sec_bin', ['gen_sec_bin.cpp'])
Alias("samples", [ocserverbasicops, occlientbasicops])
env.AppendTarget('samples')
|