Merge "Merge remote-tracking branch 'origin/master' into notification-service" into...
[platform/upstream/iotivity.git] / resource / provisioning / examples / SConscript
1 #******************************************************************
2 #
3 # Copyright 2015 Samsung Electronics 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 ##
22 # Examples build script
23 ##
24 thread_env = SConscript('#build_common/thread.scons')
25 lib_env = thread_env.Clone()
26 target_os = lib_env.get('TARGET_OS')
27
28 # Add third party libraries
29 SConscript('#resource/third_party_libs.scons', 'lib_env')
30
31 with_ra = lib_env.get('WITH_RA')
32 with_ra_ibb = lib_env.get('WITH_RA_IBB')
33
34 examples_env = lib_env.Clone()
35
36 ######################################################################
37 # Build flags
38 ######################################################################
39 examples_env.AppendUnique(CPPPATH = [
40         '../../include/',
41         '../../csdk/stack/include',
42         '../../csdk/logger/include',
43         '../../oc_logger/include',
44         '../../csdk/connectivity/api',
45         '../../csdk/connectivity/inc/pkix',
46         '../../csdk/security/include',
47         '../../csdk/security/include/internal',
48         '../../csdk/security/provisioning/include',
49         '../../csdk/security/provisioning/include/oxm',
50         '../../csdk/security/provisioning/include/internal'
51                 ])
52
53 examples_env.AppendUnique(LIBPATH = [examples_env.get('BUILD_DIR')])
54 examples_env.AppendUnique(RPATH = [examples_env.get('BUILD_DIR')])
55 examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack',
56                                     'oc_logger', 'connectivity_abstraction', 'coap'])
57 if with_ra_ibb:
58         examples_env.AppendUnique(LIBS = examples_env['RALIBS'], LIBPATH = examples_env['RALIBPATH'], RPATH = examples_env['RARPATH'])
59         print "RALIBS = %s" % examples_env['RALIBS']
60         print "RALIBPATH = %s" % examples_env['RALIBPATH']
61         print "RARPATH = %s" % examples_env['RARPATH']
62         examples_env.AppendUnique(LIBS = 'wksxmppxep')
63 else :
64         if with_ra:
65                 examples_env.AppendUnique(LIBS = ['ra_xmpp'])
66
67 if examples_env.get('SECURED') == '1':
68     examples_env.AppendUnique(LIBS = ['tinydtls'])
69     examples_env.AppendUnique(LIBS = ['timer'])
70 if examples_env.get('DTLS_WITH_X509') == '1':
71         examples_env.AppendUnique(LIBS = ['CKManager'])
72         examples_env.AppendUnique(LIBS = ['asn1'])
73
74 if 'g++' in examples_env.get('CXX'):
75    examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
76
77 if target_os in ['android']:
78         examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
79         examples_env.AppendUnique(LIBS = ['gnustl_shared'])
80
81         if not examples_env.get('RELEASE'):
82                 examples_env.AppendUnique(LIBS = ['log'])
83
84 if target_os in ['darwin', 'ios']:
85         examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
86
87
88 ######################################################################
89 # Source files and Targets
90 ######################################################################
91 provisioningclient = examples_env.Program('provisioningclient', 'provisioningclient.cpp')
92
93 src_dir = examples_env.get('SRC_DIR')
94 svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
95 svr_db_build_dir = examples_env.get('BUILD_DIR') +'/resource/provisioning/examples/'
96
97 clientjson = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.json')
98 clientdat = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.dat')
99
100 Alias("examples", [provisioningclient, clientjson,clientdat])
101 examples_env.AppendTarget('examples')