Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / resource / csdk / stack / samples / linux / secure / 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
23 samples_env = env.Clone()
24 ######################################################################
25 # Build flags
26 ######################################################################
27 samples_env.PrependUnique(CPPPATH = [
28                 '../../../../logger/include',
29                 '../../../../stack/include',
30                 '../../../../security/include',
31                 '../../../../../../extlibs/cjson',
32                 '../../../../../oc_logger/include'
33                 ])
34
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'])
38
39         # Note: 'pthread' is in libc for android.
40         if target_os != 'android':
41                 samples_env.AppendUnique(LIBS = ['-lpthread'])
42
43 samples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
44 samples_env.PrependUnique(LIBS = ['octbstack', 'm', 'connectivity_abstraction', 'coap'])
45 if env.get('SECURED') == '1':
46     samples_env.AppendUnique(LIBS = ['tinydtls'])
47
48 samples_env.Append(LINKFLAGS = ['-Wl,--no-as-needed'])
49
50 if target_os == 'android':
51         samples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
52         samples_env.AppendUnique(LIBS = ['gnustl_shared'])
53         samples_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
54
55         if not env.get('RELEASE'):
56                 samples_env.AppendUnique(LIBS = ['log'])
57
58 if target_os in ['darwin', 'ios']:
59         samples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
60
61 samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
62
63 ######################################################################
64 # Source files and Targets
65 ######################################################################
66
67 ocserverbasicops = samples_env.Program('ocserverbasicops', ['common.cpp', 'ocserverbasicops.cpp'])
68 occlientbasicops = samples_env.Program('occlientbasicops', ['common.cpp', 'occlientbasicops.cpp'])
69 ocamsservice = samples_env.Program('ocamsservice', ['common.cpp', 'ocamsservice.cpp'])
70
71 Alias("samples", [ocserverbasicops, occlientbasicops, ocamsservice])
72
73 env.AppendTarget('samples')
74
75 src_dir = samples_env.get('SRC_DIR')
76 sec_samples_src_dir = src_dir + '/resource/csdk/stack/samples/linux/secure/'
77 sec_samples_build_dir = env.get('BUILD_DIR') +'/resource/csdk/stack/samples/linux/secure'
78
79 samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
80     sec_samples_src_dir + 'oic_svr_db_server.json'))
81 samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
82     sec_samples_src_dir + 'oic_svr_db_client.json'))
83 samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
84     sec_samples_src_dir + 'oic_amss_db.json'))
85