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 with_ra = env.get('WITH_RA')
30 with_ra_ibb = env.get('WITH_RA_IBB')
32 examples_env = lib_env.Clone()
34 ######################################################################
36 ######################################################################
37 examples_env.AppendUnique(CPPPATH = [
39 '../../csdk/stack/include',
40 '../../csdk/logger/include',
41 '../../oc_logger/include',
42 '../../csdk/connectivity/api',
43 '../../csdk/security/include',
44 '../../csdk/security/include/internal',
45 '../../csdk/security/provisioning/include',
46 '../../csdk/security/provisioning/include/oxm',
47 '../../csdk/security/provisioning/include/internal'
50 target_os = env.get('TARGET_OS')
51 if target_os not in ['windows']:
52 examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
54 # Note: 'pthread' is in libc for android. On other platform, if use
55 # new gcc(>4.9?) it isn't required, otherwise, it's required
56 if target_os != 'android':
57 examples_env.AppendUnique(LIBS = ['-lpthread', '-ldl'])
59 examples_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
60 examples_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
61 examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack',
62 'oc_logger', 'connectivity_abstraction', 'coap'])
64 examples_env.AppendUnique(LIBS = examples_env['RALIBS'], LIBPATH = examples_env['RALIBPATH'], RPATH = examples_env['RARPATH'])
65 print "RALIBS = %s" % examples_env['RALIBS']
66 print "RALIBPATH = %s" % examples_env['RALIBPATH']
67 print "RARPATH = %s" % examples_env['RARPATH']
68 examples_env.AppendUnique(LIBS = 'wksxmppxep')
71 examples_env.AppendUnique(LIBS = ['ra_xmpp'])
73 if env.get('SECURED') == '1':
74 examples_env.AppendUnique(LIBS = ['tinydtls'])
75 examples_env.AppendUnique(LIBS = ['timer'])
76 if env.get('DTLS_WITH_X509') == '1':
77 examples_env.AppendUnique(LIBS = ['CKManager'])
78 examples_env.AppendUnique(LIBS = ['asn1'])
80 if target_os == 'android':
81 examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
82 examples_env.AppendUnique(LIBS = ['gnustl_shared'])
84 if not env.get('RELEASE'):
85 examples_env.AppendUnique(LIBS = ['log'])
87 if target_os in ['darwin', 'ios']:
88 examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
90 ######################################################################
91 # Source files and Targets
92 ######################################################################
93 provisioningclient = examples_env.Program('provisioningclient', 'provisioningclient.cpp')
95 src_dir = examples_env.get('SRC_DIR')
96 svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
97 svr_db_build_dir = env.get('BUILD_DIR') +'/resource/provisioning/examples/'
99 clientjson = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.json')
100 clientdat = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.dat')
102 Alias("examples", [provisioningclient, clientjson,clientdat])
103 env.AppendTarget('examples')