IOT-1072 Unfork libcoap: add build flag
[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                 '../../extlibs/cjson/'
48                 ])
49
50 target_os = ocprovision_env.get('TARGET_OS')
51 if target_os not in ['windows']:
52         ocprovision_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
53
54 if target_os == 'android':
55         ocprovision_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
56         ocprovision_env.AppendUnique(LIBPATH = [ocprovision_env.get('BUILD_DIR')])
57         ocprovision_env.AppendUnique(LIBS = ['oc', 'octbstack', 'ocpmapi', 'oc_logger', 'boost_thread', 'gnustl_shared', 'log'])
58
59 if target_os in ['linux', 'tizen']:
60         ocprovision_env.AppendUnique(LIBPATH = [ocprovision_env.get('BUILD_DIR')])
61         ocprovision_env.AppendUnique(LIBS = ['oc', 'octbstack', 'ocpmapi', 'oc_logger', 'boost_thread'])
62
63 if target_os in ['darwin', 'ios']:
64         ocprovision_env.AppendUnique(LIBPATH = [ocprovision_env.get('BUILD_DIR')])
65         ocprovision_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])
66
67 ######################################################################
68 # Source files and Targets
69 ######################################################################
70 ocprovision_src = [
71                 'src/OCProvisioningManager.cpp'
72         ]
73
74 ocprovision = ocprovision_env.SharedLibrary('ocprovision', ocprovision_src)
75 ocprovision_env.InstallTarget(ocprovision, 'libocprovision')
76 ocprovision_env.UserInstallTargetLib(ocprovision, 'libocprovision')
77
78 if target_os in ['linux', 'tizen']:
79     SConscript('examples/SConscript')