replace : iotivity -> iotivity-sec
[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         '../../../extlibs/cjson',
43         '../../../extlibs/mbedtls/mbedtls/include',
44         '../../csdk/logger/include',
45         '../../oc_logger/include',
46         '../../csdk/connectivity/api',
47         '../../csdk/connectivity/inc/pkix',
48         '../../csdk/connectivity/common/inc',
49         '../../csdk/connectivity/lib/libcoap-4.1.1/include',
50         '../../csdk/security/include',
51         '../../csdk/security/include/internal',
52         '../../csdk/security/provisioning/include/cloud',
53         '../../csdk/security/provisioning/include',
54         '../../csdk/security/provisioning/include/oxm',
55         '../../csdk/security/provisioning/include/internal'
56                 ])
57
58 examples_env.AppendUnique(LIBPATH = [examples_env.get('BUILD_DIR')])
59 examples_env.AppendUnique(RPATH = [examples_env.get('BUILD_DIR')])
60 examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack',
61                                     'oc_logger', 'connectivity_abstraction', 'coap'])
62 if with_ra_ibb:
63         examples_env.AppendUnique(LIBS = examples_env['RALIBS'], LIBPATH = examples_env['RALIBPATH'], RPATH = examples_env['RARPATH'])
64         print "RALIBS = %s" % examples_env['RALIBS']
65         print "RALIBPATH = %s" % examples_env['RALIBPATH']
66         print "RARPATH = %s" % examples_env['RARPATH']
67         examples_env.AppendUnique(LIBS = 'wksxmppxep')
68 else :
69         if with_ra:
70                 examples_env.AppendUnique(LIBS = ['ra_xmpp'])
71
72 if examples_env.get('SECURED') == '1':
73     examples_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
74
75 if 'g++' in examples_env.get('CXX'):
76    examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
77
78 if target_os in ['android']:
79         examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
80         examples_env.AppendUnique(LIBS = ['gnustl_shared'])
81
82         if not examples_env.get('RELEASE'):
83                 examples_env.AppendUnique(LIBS = ['log'])
84
85 if target_os in ['darwin', 'ios']:
86         examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
87
88 if target_os == 'tizen':
89     examples_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
90 if examples_env.get('MULTIPLE_OWNER') == '1':
91     examples_env.AppendUnique(CPPDEFINES = ['MULTIPLE_OWNER'])
92
93 ######################################################################
94 # Source files and Targets
95 ######################################################################
96 provisioningclient = examples_env.Program('provisioningclient', 'provisioningclient.cpp')
97 if examples_env.get('MULTIPLE_OWNER') == '1':
98         subownerclient = examples_env.Program('subownerclient', 'subownerclient.cpp')
99
100 if examples_env.get('WITH_TCP') == True:
101         cloudClient = examples_env.Program('cloudClient',['cloudClient.cpp', 'cloudAuth.cpp', 'cloudWrapper.cpp'])
102
103 src_dir = examples_env.get('SRC_DIR')
104 svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
105 svr_db_build_dir = examples_env.get('BUILD_DIR') +'/resource/provisioning/examples/'
106
107 clientjson = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.json')
108 clientdat = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.dat')
109
110 if examples_env.get('MULTIPLE_OWNER') == '1':
111         subownerclientdat = examples_env.Install(svr_db_build_dir,
112                 svr_db_src_dir + 'oic_svr_db_subowner_client.dat')
113         Alias("subowner", [subownerclientdat, subownerclient])
114         examples_env.AppendTarget("subowner")
115
116 if examples_env.get('WITH_TCP') == True:
117         clouddat = examples_env.Install(svr_db_build_dir,
118                 svr_db_src_dir + 'cloud.dat')
119         rootcert = examples_env.Install(svr_db_build_dir,
120                 svr_db_src_dir + 'rootca.crt')
121         Alias("cloud", [clouddat, rootcert, cloudClient])
122         examples_env.AppendTarget("cloud")
123
124 Alias("examples", [provisioningclient, clientjson,clientdat])
125 examples_env.AppendTarget('examples')
126