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