Fix for SVACE issue. (#326)
[platform/upstream/iotivity.git] / resource / 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 Import('env')
22
23 lib_env = env.Clone()
24 SConscript(lib_env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
25
26 ocprovision_env = lib_env.Clone()
27
28 ######################################################################
29 # Build flags
30 ######################################################################
31 with_upstream_libcoap = ocprovision_env.get('WITH_UPSTREAM_LIBCOAP')
32 if with_upstream_libcoap == '1':
33         # For bring up purposes only, we manually copy the forked version to where the unforked version is downloaded.
34         ocprovision_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
35 else:
36         # For bring up purposes only, the forked version will live here.
37         ocprovision_env.AppendUnique(CPPPATH = ['../csdk/connectivity/lib/libcoap-4.1.1/include'])
38
39 ocprovision_env.AppendUnique(CPPPATH = [
40                 '../include/',
41                 '../csdk/stack/include',
42                 '../csdk/logger/include',
43                 '../oc_logger/include',
44                 '../csdk/connectivity/api',
45                 '../csdk/security/include',
46                 '../csdk/connectivity/inc/pkix',
47                 '../csdk/security/provisioning/include',
48                 '../csdk/security/provisioning/include/oxm',
49                 '../csdk/security/provisioning/include/internal',
50                 '../csdk/security/provisioning/include/cloud',
51         '../csdk/connectivity/lib/libcoap-4.1.1/',
52         '../../extlibs/cjson/',
53         '../../extlibs/mbedtls/mbedtls/include'
54                 ])
55
56 target_os = ocprovision_env.get('TARGET_OS')
57 if target_os not in ['windows']:
58         ocprovision_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
59
60 if target_os == 'android':
61         ocprovision_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
62         ocprovision_env.AppendUnique(LIBPATH = [ocprovision_env.get('BUILD_DIR')])
63         ocprovision_env.AppendUnique(LIBS = ['oc', 'octbstack', 'ocpmapi', 'oc_logger', 'boost_thread', 'gnustl_shared', 'log'])
64         ocprovision_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libocprovision.so'])
65
66 if target_os in ['linux', 'tizen']:
67         ocprovision_env.AppendUnique(LIBPATH = [ocprovision_env.get('BUILD_DIR')])
68         ocprovision_env.AppendUnique(LIBS = ['oc', 'octbstack', 'ocpmapi', 'oc_logger', 'boost_thread'])
69
70 if target_os in ['darwin', 'ios']:
71         ocprovision_env.AppendUnique(LIBPATH = [ocprovision_env.get('BUILD_DIR')])
72         ocprovision_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])
73
74 ######################################################################
75 # Source files and Targets
76 ######################################################################
77 ocprovision_src = [
78                 'src/OCProvisioningManager.cpp'
79         ]
80
81 if ocprovision_env.get('WITH_TCP') == True:
82         ocprovision_src = ocprovision_src + [
83         'src/OCCloudProvisioning.cpp'
84         ]
85         ocprovision_env.UserInstallTargetHeader('../include/OCCloudProvisioning.hpp', 'resource', 'OCCloudProvisioning.hpp')
86
87 if target_os not in ['darwin', 'ios']:
88     ocprovision = ocprovision_env.SharedLibrary('ocprovision', ocprovision_src)
89 else:
90     ocprovision = ocprovision_env.StaticLibrary('ocprovision', ocprovision_src)
91 ocprovision_env.InstallTarget(ocprovision, 'libocprovision')
92 ocprovision_env.UserInstallTargetLib(ocprovision, 'libocprovision')
93 ocprovision_env.UserInstallTargetHeader('../include/OCProvisioningManager.hpp', 'resource', 'OCProvisioningManager.hpp')
94
95 if target_os in ['linux', 'tizen']:
96     SConscript('examples/SConscript')