1 #******************************************************************
3 # Copyright 2015 Samsung Electronics 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 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # Examples build script
25 # Add third party libraries
27 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
29 examples_env = lib_env.Clone()
31 ######################################################################
33 ######################################################################
34 examples_env.AppendUnique(CPPPATH = [
36 '../../csdk/stack/include',
37 '../../csdk/logger/include',
38 '../../oc_logger/include',
39 '../../csdk/connectivity/api',
40 '../../csdk/security/include',
41 '../../csdk/security/provisioning/include',
42 '../../csdk/security/provisioning/include/oxm',
43 '../../csdk/security/provisioning/include/internal'
46 target_os = env.get('TARGET_OS')
47 if target_os not in ['windows', 'winrt']:
48 examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
50 # Note: 'pthread' is in libc for android. On other platform, if use
51 # new gcc(>4.9?) it isn't required, otherwise, it's required
52 if target_os != 'android':
53 examples_env.AppendUnique(LIBS = ['-lpthread', '-ldl'])
55 examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
56 examples_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
57 examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack',
58 'oc_logger', 'connectivity_abstraction', 'coap'])
59 if env.get('SECURED') == '1':
60 examples_env.AppendUnique(LIBS = ['tinydtls'])
61 if env.get('DTLS_WITH_X509') == '1':
62 examples_env.AppendUnique(LIBS = ['CKManager'])
63 examples_env.AppendUnique(LIBS = ['asn1'])
65 if target_os == 'android':
66 examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
67 examples_env.AppendUnique(LIBS = ['gnustl_shared'])
69 if not env.get('RELEASE'):
70 examples_env.AppendUnique(LIBS = ['log'])
72 if target_os in ['darwin', 'ios']:
73 examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
75 ######################################################################
76 # Source files and Targets
77 ######################################################################
78 provisioningclient = examples_env.Program('provisioningclient', 'provisioningclient.cpp')
80 Alias("examples", [provisioningclient])
81 env.AppendTarget('examples')
83 src_dir = examples_env.get('SRC_DIR')
84 svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
85 svr_db_build_dir = env.get('BUILD_DIR') +'/resource/provisioning/examples/'
86 examples_env.Alias("install", examples_env.Install( svr_db_build_dir,
87 svr_db_src_dir + 'oic_svr_db_client.json'))