Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / resource / src / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 Intel Mobile Communications GmbH 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 # OCLib (share library) build script
23 ##
24 Import('env')
25
26 # Add third party libraries
27 lib_env = env.Clone()
28 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
29
30 oclib_env = lib_env.Clone()
31 ######################################################################
32 # Build flags
33 ######################################################################
34 oclib_env.AppendUnique(CPPPATH = [
35                 '../include/',
36                 '../csdk/stack/include',
37                 '../c_common/ocrandom/include',
38                 '../csdk/logger/include',
39                 '../oc_logger/include',
40                 '../csdk/connectivity/lib/libcoap-4.1.1',
41                 '../csdk/connectivity/api'
42                 ])
43
44 oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
45
46 oclib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])
47 oclib_env.AppendUnique(LIBS = ['connectivity_abstraction'])
48
49 target_os = env.get('TARGET_OS')
50 if target_os == 'linux':
51         oclib_env.AppendUnique(LIBS = ['pthread'])
52
53 if target_os not in ['windows', 'winrt']:
54         oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
55
56 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
57         oclib_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
58
59 if target_os == 'android':
60         oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
61         oclib_env.AppendUnique(LIBS = ['boost_thread', 'gnustl_shared', 'log'])
62
63 if target_os == 'tizen':
64         oclib_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
65
66 if target_os in ['linux'] and env.get('SIMULATOR', False):
67     oclib_env.Append( RPATH = env.Literal('\\$$ORIGIN'))
68
69 ######################################################################
70 # Source files and Targets
71 ######################################################################
72 oclib_src = [
73                 'OCPlatform.cpp',
74                 'OCPlatform_impl.cpp',
75                 'OCResource.cpp',
76                 'OCUtilities.cpp',
77                 'OCException.cpp',
78                 'OCRepresentation.cpp',
79                 'InProcServerWrapper.cpp',
80                 'InProcClientWrapper.cpp',
81                 'OCResourceRequest.cpp',
82                 'CAManager.cpp'
83         ]
84
85 oclib = oclib_env.SharedLibrary('oc', oclib_src)
86 oclib_env.InstallTarget(oclib, 'liboc')
87 oclib_env.UserInstallTargetLib(oclib, 'liboc')
88
89 header_dir = env.get('SRC_DIR') + '/resource/include/'
90
91 oclib_env.UserInstallTargetHeader(header_dir + 'OCApi.h', 'resource', 'OCApi.h')
92 oclib_env.UserInstallTargetHeader(header_dir + 'OCHeaderOption.h', 'resource', 'OCHeaderOption.h')
93 oclib_env.UserInstallTargetHeader(header_dir + 'OCException.h', 'resource', 'OCException.h')
94 oclib_env.UserInstallTargetHeader(header_dir + 'StringConstants.h', 'resource', 'StringConstants.h')
95
96 oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform.h', 'resource', 'OCPlatform.h')
97 oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform_impl.h', 'resource', 'OCPlatform_impl.h')
98 oclib_env.UserInstallTargetHeader(header_dir + 'WrapperFactory.h', 'resource', 'WrapperFactory.h')
99 oclib_env.UserInstallTargetHeader(header_dir + 'IClientWrapper.h', 'resource', 'IClientWrapper.h')
100 oclib_env.UserInstallTargetHeader(header_dir + 'IServerWrapper.h', 'resource', 'IServerWrapper.h')
101 oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcClientWrapper.h', 'resource', 'OutOfProcClientWrapper.h')
102 oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcServerWrapper.h', 'resource', 'OutOfProcServerWrapper.h')
103 oclib_env.UserInstallTargetHeader(header_dir + 'InProcClientWrapper.h', 'resource', 'InProcClientWrapper.h')
104 oclib_env.UserInstallTargetHeader(header_dir + 'InProcServerWrapper.h', 'resource', 'InProcServerWrapper.h')
105 oclib_env.UserInstallTargetHeader(header_dir + 'InitializeException.h', 'resource', 'InitializeException.h')
106 oclib_env.UserInstallTargetHeader(header_dir + 'ResourceInitException.h', 'resource', 'ResourceInitException.h')
107
108 oclib_env.UserInstallTargetHeader(header_dir + 'OCRepresentation.h', 'resource', 'OCRepresentation.h')
109 oclib_env.UserInstallTargetHeader(header_dir + 'AttributeValue.h', 'resource', 'AttributeValue.h')
110
111 oclib_env.UserInstallTargetHeader(header_dir + 'OCResource.h', 'resource', 'OCResource.h')
112 oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceRequest.h', 'resource', 'OCResourceRequest.h')
113 oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceResponse.h', 'resource', 'OCResourceResponse.h')
114 oclib_env.UserInstallTargetHeader(header_dir + 'OCUtilities.h', 'resource', 'OCUtilities.h')
115
116 oclib_env.UserInstallTargetHeader(header_dir + 'CAManager.h', 'resource', 'CAManager.h')
117
118 # Add Provisioning library
119 if target_os in ['linux', 'android', 'tizen'] and env.get('SECURED') == '1':
120         SConscript('../provisioning/SConscript')