Build: Add thread.scons to propagate pthread if needed
[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/security/include',
46         '../../csdk/security/include/internal',
47         '../../csdk/security/provisioning/include',
48         '../../csdk/security/provisioning/include/oxm',
49         '../../csdk/security/provisioning/include/internal'
50                 ])
51
52 examples_env.AppendUnique(LIBPATH = [examples_env.get('BUILD_DIR')])
53 examples_env.AppendUnique(RPATH = [examples_env.get('BUILD_DIR')])
54 examples_env.PrependUnique(LIBS = ['ocprovision', 'oc', 'ocpmapi', 'octbstack',
55                                     'oc_logger', 'connectivity_abstraction', 'coap'])
56 if with_ra_ibb:
57         examples_env.AppendUnique(LIBS = examples_env['RALIBS'], LIBPATH = examples_env['RALIBPATH'], RPATH = examples_env['RARPATH'])
58         print "RALIBS = %s" % examples_env['RALIBS']
59         print "RALIBPATH = %s" % examples_env['RALIBPATH']
60         print "RARPATH = %s" % examples_env['RARPATH']
61         examples_env.AppendUnique(LIBS = 'wksxmppxep')
62 else :
63         if with_ra:
64                 examples_env.AppendUnique(LIBS = ['ra_xmpp'])
65
66 if examples_env.get('SECURED') == '1':
67     examples_env.AppendUnique(LIBS = ['tinydtls'])
68     examples_env.AppendUnique(LIBS = ['timer'])
69 if examples_env.get('DTLS_WITH_X509') == '1':
70         examples_env.AppendUnique(LIBS = ['CKManager'])
71         examples_env.AppendUnique(LIBS = ['asn1'])
72
73 if 'g++' in examples_env.get('CXX'):
74    examples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
75
76 if target_os in ['android']:
77         examples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
78         examples_env.AppendUnique(LIBS = ['gnustl_shared'])
79
80         if not examples_env.get('RELEASE'):
81                 examples_env.AppendUnique(LIBS = ['log'])
82
83 if target_os in ['darwin', 'ios']:
84         examples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
85
86
87 ######################################################################
88 # Source files and Targets
89 ######################################################################
90 provisioningclient = examples_env.Program('provisioningclient', 'provisioningclient.cpp')
91
92 src_dir = examples_env.get('SRC_DIR')
93 svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
94 svr_db_build_dir = examples_env.get('BUILD_DIR') +'/resource/provisioning/examples/'
95
96 clientjson = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.json')
97 clientdat = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.dat')
98
99 Alias("examples", [provisioningclient, clientjson,clientdat])
100 examples_env.AppendTarget('examples')