1 # //******************************************************************
3 # // Copyright 2015 Samsung Electronics All Rights Reserved.
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # // http://www.apache.org/licenses/LICENSE-2.0
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.
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 provisioning_env = env.Clone()
25 root_dir = './../../../../'
27 ######################################################################
29 ######################################################################
30 provisioning_env.AppendUnique(CPPPATH = [
31 '../../stack/include',
32 '../../stack/include/internal',
33 '../../../c_common/ocrandom/include',
34 '../../logger/include',
35 '../../../oc_logger/include',
36 '../../../c_common/oic_malloc/include',
40 '../../resource/csdk/security/include',
41 '../../../../extlibs/cjson/',
42 '../../../../extlibs/tinydtls/',
43 '../../connectivity/inc',
44 '../../connectivity/external/inc',
45 '../../connectivity/common/inc',
46 '../../connectivity/lib/libcoap-4.1.1',
47 '../../connectivity/api',
49 '../include/internal',
50 '../../../../extlibs/tinydtls/ecc',
51 '../../../../extlibs/tinydtls/sha2',
52 '../../../../extlibs/asn1cert',
55 target_os = env.get('TARGET_OS')
57 if target_os != 'tizen':
58 provisioning_env.AppendUnique(CPPPATH = ['../../../../extlibs/sqlite3'])
60 provisioning_env.AppendUnique(CPPDEFINES= ['__WITH_DTLS__'])
61 if target_os not in ['windows']:
62 provisioning_env.AppendUnique(CFLAGS = ['-std=c99'])
63 if target_os not in ['windows', 'msys_nt']:
64 provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
66 # Note: 'pthread' is in libc for android. On other platform, if use
67 # new gcc(>4.9?) it isn't required, otherwise, it's required
68 if target_os != 'android':
69 provisioning_env.AppendUnique(LIBS = ['-lpthread', '-ldl'])
71 provisioning_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
72 provisioning_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
74 provisioning_env.AppendUnique(LIBS = ['tinydtls'])
76 if env.get('DTLS_WITH_X509') == '1':
77 provisioning_env.AppendUnique(LIBS = ['CKManager', 'asn1'])
79 if target_os not in ['msys_nt', 'windows', 'android']:
80 provisioning_env.ParseConfig('pkg-config --libs glib-2.0')
82 if target_os in ['windows', 'msys_nt']:
83 provisioning_env.AppendUnique(LIBS = ['ws2_32', 'advapi32', 'iphlpapi', 'timer'])
85 if target_os == 'tizen':
86 provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')
88 if target_os == 'android':
89 provisioning_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
90 provisioning_env.AppendUnique(LIBS = ['gnustl_static'])
92 if not env.get('RELEASE'):
93 provisioning_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
95 if target_os in ['darwin', 'ios']:
96 provisioning_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
98 ######################################################################
99 # Source files and Targets
100 ######################################################################
103 'src/credentialgenerator.c',
104 'src/ownershiptransfermanager.c',
105 'src/secureresourceprovider.c',
106 'src/ocprovisioningmanager.c',
107 'src/oxmjustworks.c',
108 'src/oxmrandompin.c',
109 'src/provisioningdatabasemanager.c' ]
111 if target_os != 'tizen':
112 provisioning_src = provisioning_src + [root_dir+'/extlibs/sqlite3/sqlite3.c' ]
114 if target_os == 'windows':
115 # TODO: Add OC_EXPORT annotations and enable generation of Windows DLL
116 provisioningserver = provisioning_env.StaticLibrary('ocpmapi', provisioning_src)
118 provisioningserver = provisioning_env.SharedLibrary('ocpmapi', provisioning_src)
120 provisioning_env.InstallTarget(provisioningserver, 'ocpmapi')
121 provisioning_env.UserInstallTargetLib(provisioningserver, 'ocpmapi')
123 if env.get('DTLS_WITH_X509') == '1':
124 SConscript('ck_manager/SConscript')
126 if target_os in ['linux', 'msys_nt', 'windows']:
127 SConscript('sample/SConscript')