Merge branch 'master' into plugin-interface
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / 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 Import('env')
23
24 provisioning_env = env.Clone()
25 root_dir = './../../../../'
26
27 ######################################################################
28 # Build flags
29 ######################################################################
30 provisioning_env.AppendUnique(CPPPATH = [
31                 '../../stack/include',
32                 '../../stack/include/internal',
33                 '../../ocrandom/include',
34                 '../../logger/include',
35                 '../../../oc_logger/include',
36                 '../../ocmalloc/include',
37                 'include',
38                 'include/internal',
39                 'include/oxm',
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',
48                 '../include',
49                 '../include/internal',
50                 '../../../../extlibs/sqlite3',
51                 '../../../../extlibs/tinydtls/ecc',
52                 '../../../../extlibs/tinydtls/sha2',
53                 '../../../../extlibs/asn1cert',
54                 'ck_manager/include'
55                 ])
56 target_os = env.get('TARGET_OS')
57 provisioning_env.AppendUnique(CFLAGS = ['-D__WITH_DTLS__'])
58 provisioning_env.AppendUnique(CFLAGS = ['-std=c99'])
59 if target_os not in ['windows', 'winrt']:
60         provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread', '-D__WITH_DTLS__'])
61
62         # Note: 'pthread' is in libc for android. On other platform, if use
63         # new gcc(>4.9?) it isn't required, otherwise, it's required
64         if target_os != 'android':
65                 provisioning_env.AppendUnique(LIBS = ['-lpthread'])
66
67
68 provisioning_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
69 provisioning_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
70
71 provisioning_env.AppendUnique(LIBS = ['tinydtls'])
72
73 if env.get('DTLS_WITH_X509') == '1':
74         provisioning_env.AppendUnique(LIBS = ['CKManger'])
75
76 provisioning_env.ParseConfig('pkg-config --libs glib-2.0');
77
78 if target_os == 'android':
79         provisioning_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
80         provisioning_env.AppendUnique(LIBS = ['gnustl_static'])
81
82         if not env.get('RELEASE'):
83                 provisioning_env.AppendUnique(LIBS = ['log'])
84
85 if target_os in ['darwin', 'ios']:
86         provisioning_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
87
88 ######################################################################
89 # Source files and Targets
90 ######################################################################
91 provisioning_src = [
92         'src/pmutility.c',
93         'src/credentialgenerator.c',
94         'src/ownershiptransfermanager.c',
95         'src/secureresourceprovider.c',
96         'src/ocprovisioningmanager.c',
97         'src/oxmjustworks.c',
98         'src/oxmrandompin.c',
99         'src/provisioningdatabasemanager.c',
100         root_dir+'/extlibs/sqlite3/sqlite3.c' ]
101 provisioningserver = provisioning_env.StaticLibrary('ocpmapi', provisioning_src)
102
103 provisioning_env.InstallTarget(provisioningserver, 'libocpmapi')
104 provisioning_env.UserInstallTargetLib(provisioningserver, 'libocpmapi')
105
106 if env.get('DTLS_WITH_X509') == '1':
107         SConscript('ck_manager/SConscript')
108
109 if target_os in ['linux']:
110         SConscript('sample/SConscript')
111