1 #******************************************************************
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # OCLib (share library) build script
26 # Add third party libraries
28 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
30 oclib_env = lib_env.Clone()
31 ######################################################################
33 ######################################################################
34 oclib_env.AppendUnique(CPPPATH = [
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'
44 oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
46 oclib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])
47 oclib_env.AppendUnique(LIBS = ['connectivity_abstraction'])
49 target_os = env.get('TARGET_OS')
50 if target_os == 'linux':
51 oclib_env.AppendUnique(LIBS = ['pthread'])
53 if target_os not in ['windows', 'winrt']:
54 oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
56 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
57 oclib_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
59 if target_os == 'android':
60 oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
61 oclib_env.AppendUnique(LIBS = ['boost_thread', 'gnustl_shared', 'log'])
63 if target_os == 'tizen':
64 oclib_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
66 ######################################################################
67 # Source files and Targets
68 ######################################################################
71 'OCPlatform_impl.cpp',
75 'OCRepresentation.cpp',
76 'InProcServerWrapper.cpp',
77 'InProcClientWrapper.cpp',
78 'OCResourceRequest.cpp',
82 oclib = oclib_env.SharedLibrary('oc', oclib_src)
83 oclib_env.InstallTarget(oclib, 'liboc')
84 oclib_env.UserInstallTargetLib(oclib, 'liboc')
86 header_dir = env.get('SRC_DIR') + '/resource/include/'
88 oclib_env.UserInstallTargetHeader(header_dir + 'OCApi.h', 'resource', 'OCApi.h')
89 oclib_env.UserInstallTargetHeader(header_dir + 'OCHeaderOption.h', 'resource', 'OCHeaderOption.h')
90 oclib_env.UserInstallTargetHeader(header_dir + 'OCException.h', 'resource', 'OCException.h')
91 oclib_env.UserInstallTargetHeader(header_dir + 'StringConstants.h', 'resource', 'StringConstants.h')
93 oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform.h', 'resource', 'OCPlatform.h')
94 oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform_impl.h', 'resource', 'OCPlatform_impl.h')
95 oclib_env.UserInstallTargetHeader(header_dir + 'WrapperFactory.h', 'resource', 'WrapperFactory.h')
96 oclib_env.UserInstallTargetHeader(header_dir + 'IClientWrapper.h', 'resource', 'IClientWrapper.h')
97 oclib_env.UserInstallTargetHeader(header_dir + 'IServerWrapper.h', 'resource', 'IServerWrapper.h')
98 oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcClientWrapper.h', 'resource', 'OutOfProcClientWrapper.h')
99 oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcServerWrapper.h', 'resource', 'OutOfProcServerWrapper.h')
100 oclib_env.UserInstallTargetHeader(header_dir + 'InProcClientWrapper.h', 'resource', 'InProcClientWrapper.h')
101 oclib_env.UserInstallTargetHeader(header_dir + 'InProcServerWrapper.h', 'resource', 'InProcServerWrapper.h')
102 oclib_env.UserInstallTargetHeader(header_dir + 'InitializeException.h', 'resource', 'InitializeException.h')
103 oclib_env.UserInstallTargetHeader(header_dir + 'ResourceInitException.h', 'resource', 'ResourceInitException.h')
105 oclib_env.UserInstallTargetHeader(header_dir + 'OCRepresentation.h', 'resource', 'OCRepresentation.h')
106 oclib_env.UserInstallTargetHeader(header_dir + 'AttributeValue.h', 'resource', 'AttributeValue.h')
108 oclib_env.UserInstallTargetHeader(header_dir + 'OCResource.h', 'resource', 'OCResource.h')
109 oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceRequest.h', 'resource', 'OCResourceRequest.h')
110 oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceResponse.h', 'resource', 'OCResourceResponse.h')
112 oclib_env.UserInstallTargetHeader(header_dir + 'CAManager.h', 'resource', 'CAManager.h')
114 # Add Provisioning library
115 if target_os in ['linux', 'android'] and env.get('SECURED') == '1':
116 SConscript('../provisioning/SConscript')