Imported Upstream version 0.9.2
[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
26 ######################################################################
27 # Build flags
28 ######################################################################
29 provisioning_env.AppendUnique(CPPPATH = [
30                 '../../stack/include',
31                 '../../stack/include/internal',
32                 '../../ocrandom/include',
33                 '../../logger/include',
34                 '../../../oc_logger/include',
35                 '../../ocmalloc/include',
36                 'include',
37                 'include/internal',
38                 '../../resource/csdk/security/include',
39                 '../../../../extlibs/cjson/',
40                 '../../../../../extlibs/tinydtlsra/',
41                 '../../connectivity/inc',
42                 '../../connectivity/external/inc',
43                 '../../connectivity/common/inc',
44                 '../../connectivity/api',
45                 '../include',
46                 '../include/internal'
47                 ])
48 target_os = env.get('TARGET_OS')
49 provisioning_env.AppendUnique(CFLAGS = ['-D__WITH_DTLS__'])
50 provisioning_env.AppendUnique(CFLAGS = ['-std=c99'])
51 if target_os not in ['windows', 'winrt']:
52         provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread', '-D__WITH_DTLS__'])
53
54         # Note: 'pthread' is in libc for android. On other platform, if use
55         # new gcc(>4.9?) it isn't required, otherwise, it's required
56         if target_os != 'android':
57                 provisioning_env.AppendUnique(LIBS = ['-lpthread'])
58
59
60 provisioning_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
61 provisioning_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap'])
62
63 provisioning_env.AppendUnique(LIBS = ['tinydtls'])
64
65 provisioning_env.ParseConfig('pkg-config --libs glib-2.0');
66
67 if target_os == 'android':
68         provisioning_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
69         provisioning_env.AppendUnique(LIBS = ['gnustl_static'])
70
71         if not env.get('RELEASE'):
72                 provisioning_env.AppendUnique(LIBS = ['log'])
73
74 if target_os in ['darwin', 'ios']:
75         provisioning_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
76
77 ######################################################################
78 # Source files and Targets
79 ######################################################################
80 provisioning_src = [
81         'src/provisioningmanager.c',
82     'src/credentialgenerator.c'
83         ]
84 provisioningserver = provisioning_env.StaticLibrary('ocspapi', provisioning_src)
85
86 provisioning_env.InstallTarget(provisioningserver, 'libocspapi')
87 provisioning_env.UserInstallTargetLib(provisioningserver, 'libocspapi')
88
89 if target_os in ['linux']:
90         SConscript('sample/SConscript')
91