IOT-1583: Removing /W3 warning from resource/csdk/security.
[iotivity.git] / resource / csdk / security / provisioning / SConscript
1 # -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*-
2 # //******************************************************************
3 # //
4 # // Copyright 2015 Samsung Electronics All Rights Reserved.
5 # //
6 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 # //
8 # // Licensed under the Apache License, Version 2.0 (the "License");
9 # // you may not use this file except in compliance with the License.
10 # // You may obtain a copy of the License at
11 # //
12 # //      http://www.apache.org/licenses/LICENSE-2.0
13 # //
14 # // Unless required by applicable law or agreed to in writing, software
15 # // distributed under the License is distributed on an "AS IS" BASIS,
16 # // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # // See the License for the specific language governing permissions and
18 # // limitations under the License.
19 # //
20 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #
22 Import('libocsrm_env')
23
24 provisioning_env = libocsrm_env.Clone()
25
26 SConscript('#build_common/thread.scons', exports = {'thread_env' : provisioning_env})
27 target_os = provisioning_env.get('TARGET_OS')
28
29 ######################################################################
30 # Build flags
31 ######################################################################
32 provisioning_env.AppendUnique(CPPPATH = [
33                 '#/resource/csdk/include',
34                 '#/resource/c_common/oic_malloc/include',
35                 '#/resource/csdk/security/provisioning/include/internal',
36                 '#/resource/csdk/security/provisioning/include/cloud',
37                 '#/resource/csdk/security/provisioning/include/oxm',
38                 '#/resource/csdk/connectivity/inc/pkix',
39                 '#/extlibs/tinydtls/ecc',
40                 '#/extlibs/tinydtls/sha2',
41                 '#/extlibs/asn1cert'
42                 ])
43
44 provisioning_env.AppendUnique(CPPDEFINES= ['__WITH_DTLS__'])
45
46 if 'g++' in provisioning_env.get('CXX'):
47     provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
48
49 provisioning_env.AppendUnique(LIBPATH = [provisioning_env.get('BUILD_DIR')])
50 provisioning_env.PrependUnique(LIBS = ['octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', 'ocsrm'])
51
52 provisioning_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
53
54
55 if target_os not in ['msys_nt', 'windows', 'android']:
56         provisioning_env.ParseConfig('pkg-config --libs glib-2.0')
57
58 if target_os in ['windows', 'msys_nt']:
59         provisioning_env.AppendUnique(LIBS = ['ws2_32', 'advapi32', 'iphlpapi'])
60
61 if target_os in ['android']:
62         provisioning_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
63         provisioning_env.AppendUnique(LIBS = ['gnustl_static'])
64
65 if target_os in ['darwin', 'ios']:
66         provisioning_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
67
68 if provisioning_env.get('LOGGING'):
69     provisioning_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
70
71 if provisioning_env.get('MULTIPLE_OWNER') == '1':
72         provisioning_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
73
74 ######################################################################
75 # Source files and Targets
76 ######################################################################
77 provisioning_src = [
78         'src/pmutility.c',
79         'src/credentialgenerator.c',
80         'src/otmcontextlist.c',
81         'src/ownershiptransfermanager.c',
82         'src/secureresourceprovider.c',
83         'src/ocprovisioningmanager.c',
84         'src/oxmjustworks.c',
85         'src/oxmrandompin.c',
86         'src/oxmmanufacturercert.c',
87         'src/provisioningdatabasemanager.c' ]
88
89 if provisioning_env.get('MULTIPLE_OWNER') == '1':
90         provisioning_src = provisioning_src + [
91                 'src/multipleownershiptransfermanager.c',
92                 'src/oxmpreconfpin.c']
93
94 if provisioning_env.get('WITH_TCP') == True:
95         provisioning_env.AppendUnique(CPPDEFINES= ['__WITH_TLS__'])
96         provisioning_src = provisioning_src + [
97         'src/cloud/utils.c',
98         'src/cloud/crl.c',
99         'src/cloud/aclgroup.c',
100         'src/cloud/aclinvite.c',
101         'src/cloud/aclid.c',
102         'src/cloud/csr.c']
103
104 if target_os in ['linux', 'tizen']:
105         provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')
106 else:
107         provisioning_env.AppendUnique(CPPPATH = ['#/extlibs/sqlite3'])
108         provisioning_src = provisioning_src + ['#/extlibs/sqlite3/sqlite3.c' ]
109
110 if target_os in ['windows', 'msys_nt']:
111         # octbstack.dll is exporting ocpmapi APIs on Windows - there is no ocpmapi.dll.
112         provisioningserver = provisioning_env.StaticLibrary('ocpmapi', provisioning_src)
113 else:
114         static_provisioning_lib = provisioning_env.StaticLibrary('ocpmapi', provisioning_src)
115         shared_provisioning_lib = provisioning_env.SharedLibrary('ocpmapi', provisioning_src)
116         provisioningserver = Flatten([static_provisioning_lib, shared_provisioning_lib])
117
118 provisioning_env.InstallTarget(provisioningserver, 'ocpmapi')
119 provisioning_env.UserInstallTargetLib(provisioningserver, 'ocpmapi')
120
121 if target_os in ['linux', 'msys_nt', 'windows', 'tizen']:
122         SConscript('sample/SConscript', 'provisioning_env')