IOT-1583: Removing /W3 warning from resource/csdk/security.
[iotivity.git] / resource / csdk / security / provisioning / sample / SConscript
1 7# //******************************************************************
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 Import('env provisioning_env')
23 import os.path
24
25 provisioning_sample_env = provisioning_env.Clone()
26 target_os = provisioning_sample_env.get('TARGET_OS')
27
28 ######################################################################
29 # Build flags
30 ######################################################################
31 provisioning_sample_env.AppendUnique(CPPPATH = [
32                 '#/resource/csdk/include',
33                 '#/extlibs/base64',
34                 '#/resource/csdk/security/provisioning/sample/cloud'
35                 ])
36
37 target_os = env.get('TARGET_OS')
38 provisioning_sample_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
39 provisioning_sample_env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
40
41 if target_os not in ['windows']:
42         provisioning_sample_env.AppendUnique(CFLAGS = ['-std=c99'])
43         provisioning_sample_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread', '-fpermissive'])
44         provisioning_sample_env.AppendUnique(LIBS = ['pthread'])
45
46 if target_os not in ['msys_nt', 'windows']:
47         provisioning_sample_env.AppendUnique(LIBS = ['dl', 'm'])
48         provisioning_sample_env.ParseConfig('pkg-config --libs glib-2.0');
49         provisioning_sample_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
50 else:
51         provisioning_sample_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
52
53 provisioning_sample_env.PrependUnique(LIBS = ['oc', 'oc_logger', 'octbstack', 'connectivity_abstraction', 'coap'])
54
55 if target_os not in ['msys_nt', 'windows']:
56         # octbstack.dll is exporting ocpmapi and ocsrm APIs on Windows.
57         provisioning_sample_env.PrependUnique(LIBS = ['ocpmapi', 'ocsrm'])
58
59 if env.get('SECURED') == '1':
60     provisioning_sample_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
61
62
63 if env.get('MULTIPLE_OWNER') == '1':
64         provisioning_sample_env.AppendUnique(CPPDEFINES = ['MULTIPLE_OWNER'])
65
66 provisioning_sample_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
67
68 if target_os == 'tizen':
69     provisioning_sample_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
70 if target_os in ['linux', 'tizen']:
71     provisioning_sample_env.ParseConfig('pkg-config --cflags --libs sqlite3')
72
73 ######################################################################
74 # Source files and Targets
75 ######################################################################
76
77 provisioningclient = provisioning_sample_env.Program('provisioningclient', 'provisioningclient.c')
78 sampleserver_justworks = provisioning_sample_env.Program('sampleserver_justworks', 'sampleserver_justworks.cpp')
79 sampleserver_randompin = provisioning_sample_env.Program('sampleserver_randompin', 'sampleserver_randompin.cpp')
80 sampleserver_mfg = provisioning_sample_env.Program('sampleserver_mfg', 'sampleserver_mfg.cpp')
81 sampleserver_mvjustworks = provisioning_sample_env.Program('sampleserver_mvjustworks', 'sampleserver_mvjustworks.cpp')
82
83 if provisioning_sample_env.get('MULTIPLE_OWNER') == '1':
84         subownerclient = provisioning_sample_env.Program('subownerclient', 'subownerclient.c')
85         sampleserver_preconfpin = provisioning_sample_env.Program('sampleserver_preconfpin', 'sampleserver_preconfpin.cpp')
86
87 if provisioning_sample_env.get('WITH_TCP') == True:
88     cloud_src = [
89         'cloud/cloudAuth.c',
90         'cloud/cloudCommon.c',
91         'cloud/cloudWrapper.c',
92         'cloud/cloudDiscovery.c']
93     cloudClient = provisioning_sample_env.Program('cloudClient', cloud_src + ['cloudClient.c'])
94     cloudServer = provisioning_sample_env.Program('cloudServer', cloud_src + ['cloudServer.c', 'cloud/cloudResource.c'])
95
96 src_dir = provisioning_sample_env.get('SRC_DIR')
97 sec_provisioning_src_dir = src_dir + '/resource/csdk/security/provisioning/sample/'
98 sec_provisioning_build_dir = env.get('BUILD_DIR') +'/resource/csdk/security/provisioning/sample/'
99
100
101 clientdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
102                                         sec_provisioning_src_dir + 'oic_svr_db_client.dat')
103 justworksdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
104                                     sec_provisioning_src_dir + 'oic_svr_db_server_justworks.dat')
105 randompindat = provisioning_sample_env.Install(sec_provisioning_build_dir,
106                                     sec_provisioning_src_dir+ 'oic_svr_db_server_randompin.dat')
107 mfgdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
108                                     sec_provisioning_src_dir+ 'oic_svr_db_server_mfg.dat')
109 randompin_with_emptyuuid_dat = provisioning_sample_env.Install(sec_provisioning_build_dir,
110                                     sec_provisioning_src_dir+ 'oic_svr_db_randompin_with_empty_deviceid.dat')
111 mvjustworksdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
112                                                                         sec_provisioning_src_dir + 'oic_svr_db_server_mvjustworks.dat')
113
114 if provisioning_sample_env.get('MULTIPLE_OWNER') == '1':
115         subownerclientdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
116                                                 sec_provisioning_src_dir + 'oic_svr_db_subowner_client.dat')
117         preconfserverdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
118                                                 sec_provisioning_src_dir + 'oic_svr_db_server_preconfpin.dat')
119
120 if provisioning_sample_env.get('WITH_TCP') == True:
121     clouddat = provisioning_sample_env.Install(sec_provisioning_build_dir,
122                                         sec_provisioning_src_dir + 'cloud.dat')
123     rootcert = provisioning_sample_env.Install(sec_provisioning_build_dir,
124                                         sec_provisioning_src_dir + 'rootca.crt')
125     Alias("cloud", [clouddat, rootcert, cloudClient, cloudServer])
126     provisioning_sample_env.AppendTarget("cloud")
127
128 if provisioning_sample_env.get('MULTIPLE_OWNER') == '1':
129         Alias("samples", [
130                                         provisioningclient, subownerclient,
131                                         sampleserver_justworks, sampleserver_randompin, sampleserver_mfg,
132                                         sampleserver_preconfpin,
133                                         clientdat, subownerclientdat, preconfserverdat,
134                                         justworksdat, randompindat, mfgdat, randompin_with_emptyuuid_dat,
135                                         mvjustworksdat
136                                 ])
137 else:
138         Alias("samples", [
139                                         provisioningclient,
140                                         sampleserver_justworks, sampleserver_randompin, sampleserver_mfg,
141                                         clientdat,
142                                         justworksdat, randompindat, mfgdat, randompin_with_emptyuuid_dat,
143                                         mvjustworksdat
144                                 ])
145
146 provisioning_sample_env.AppendTarget('samples')