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
24 thread_env = SConscript('#build_common/thread.scons')
25 lib_env = thread_env.Clone()
26 target_os = lib_env.get('TARGET_OS')
28 # Add third party libraries
29 SConscript('#resource/third_party_libs.scons', 'lib_env')
31 with_ra = lib_env.get('WITH_RA')
32 with_ra_ibb = lib_env.get('WITH_RA_IBB')
34 examples_env = lib_env.Clone()
36 ######################################################################
38 ######################################################################
39 examples_env.AppendUnique(CPPPATH = [
41 '../../csdk/stack/include',
42 '../../../extlibs/cjson',
43 '../../csdk/logger/include',
44 '../../oc_logger/include',
45 '../../csdk/connectivity/api',
46 '../../csdk/connectivity/inc/pkix',
47 '../../csdk/connectivity/common/inc',
48 '../../csdk/connectivity/lib/libcoap-4.1.1/include',
49 '../../csdk/security/include',
50 '../../csdk/security/include/internal',
51 '../../csdk/security/provisioning/include/cloud',
52 '../../csdk/security/provisioning/include',
53 '../../csdk/security/provisioning/include/oxm',
54 '../../csdk/security/provisioning/include/internal'
57 examples_env.AppendUnique(LIBPATH = [examples_env.get('BUILD_DIR')])
58 examples_env.AppendUnique(RPATH = [examples_env.get('BUILD_DIR')])
59 examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack',
60 'oc_logger', 'connectivity_abstraction', 'coap'])
62 examples_env.AppendUnique(LIBS = examples_env['RALIBS'], LIBPATH = examples_env['RALIBPATH'], RPATH = examples_env['RARPATH'])
63 print "RALIBS = %s" % examples_env['RALIBS']
64 print "RALIBPATH = %s" % examples_env['RALIBPATH']
65 print "RARPATH = %s" % examples_env['RARPATH']
66 examples_env.AppendUnique(LIBS = 'wksxmppxep')
69 examples_env.AppendUnique(LIBS = ['ra_xmpp'])
71 if examples_env.get('SECURED') == '1':
72 examples_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
74 if 'g++' in examples_env.get('CXX'):
75 examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
77 if target_os in ['android']:
78 examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
79 examples_env.AppendUnique(LIBS = ['gnustl_shared'])
81 if not examples_env.get('RELEASE'):
82 examples_env.AppendUnique(LIBS = ['log'])
84 if target_os in ['darwin', 'ios']:
85 examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
87 if target_os == 'tizen':
88 examples_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
91 ######################################################################
92 # Source files and Targets
93 ######################################################################
94 provisioningclient = examples_env.Program('provisioningclient', 'provisioningclient.cpp')
96 if examples_env.get('WITH_TCP') == True:
97 cloudClient = examples_env.Program('cloudClient',['cloudClient.cpp', 'cloudAuth.cpp', 'cloudWrapper.cpp'])
99 src_dir = examples_env.get('SRC_DIR')
100 svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
101 svr_db_build_dir = examples_env.get('BUILD_DIR') +'/resource/provisioning/examples/'
103 clientjson = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.json')
104 clientdat = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.dat')
106 if examples_env.get('WITH_TCP') == True:
107 clouddat = examples_env.Install(svr_db_build_dir,
108 svr_db_src_dir + 'cloud.dat')
109 rootcert = examples_env.Install(svr_db_build_dir,
110 svr_db_src_dir + 'rootca.crt')
111 Alias("cloud", [clouddat, rootcert, cloudClient])
112 examples_env.AppendTarget("cloud")
114 Alias("examples", [provisioningclient, clientjson,clientdat])
115 examples_env.AppendTarget('examples')