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