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
28 # Add third party libraries
30 SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
32 oclib_env = lib_env.Clone()
33 secured = lib_env.get('SECURED')
34 ######################################################################
36 ######################################################################
37 oclib_env.AppendUnique(CPPPATH = [
39 '../csdk/stack/include',
40 '../c_common/ocrandom/include',
41 '../csdk/logger/include',
42 '../oc_logger/include',
43 '../csdk/connectivity/lib/libcoap-4.1.1',
44 '../csdk/connectivity/api'
47 oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
49 oclib_env.AppendUnique(LIBS = ['oc_logger'])
50 oclib_env.PrependUnique(LIBS = ['octbstack', 'connectivity_abstraction', 'ocsrm'])
52 target_os = env.get('TARGET_OS')
53 if target_os == 'linux':
54 oclib_env.AppendUnique(LIBS = ['pthread'])
56 if target_os not in ['windows', 'winrt']:
57 oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
59 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
60 oclib_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
62 if target_os == 'android':
63 oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
64 oclib_env.AppendUnique(LIBS = ['boost_thread', 'gnustl_shared', 'log'])
65 oclib_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,liboc.so'])
67 if target_os == 'tizen':
68 oclib_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
70 if target_os in ['linux'] and env.get('SIMULATOR', False):
71 oclib_env.Append( RPATH = env.Literal('\\$$ORIGIN'))
74 if target_os in ['msys_nt']:
75 oclib_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'oc_logger')])
76 oclib_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
77 oclib_env.AppendUnique(LIBS=['octbstack', 'logger', 'oc_logger','connectivity_abstraction', 'ocsrm', 'c_common', 'routingmanager'])
78 oclib_env.AppendUnique(LIBS=[ 'coap', 'ws2_32' ,'iphlpapi'])
80 oclib_env.AppendUnique(LIBS=['tinydtls'])
82 ######################################################################
83 # Source files and Targets
84 ######################################################################
87 'OCPlatform_impl.cpp',
91 'OCRepresentation.cpp',
92 'InProcServerWrapper.cpp',
93 'InProcClientWrapper.cpp',
94 'OCResourceRequest.cpp',
98 oclib = oclib_env.SharedLibrary('oc', oclib_src)
99 oclib_env.InstallTarget(oclib, 'liboc')
100 oclib_env.UserInstallTargetLib(oclib, 'liboc')
102 header_dir = env.get('SRC_DIR') + '/resource/include/'
104 oclib_env.UserInstallTargetHeader(header_dir + 'OCApi.h', 'resource', 'OCApi.h')
105 oclib_env.UserInstallTargetHeader(header_dir + 'OCHeaderOption.h', 'resource', 'OCHeaderOption.h')
106 oclib_env.UserInstallTargetHeader(header_dir + 'OCException.h', 'resource', 'OCException.h')
107 oclib_env.UserInstallTargetHeader(header_dir + 'StringConstants.h', 'resource', 'StringConstants.h')
109 oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform.h', 'resource', 'OCPlatform.h')
110 oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform_impl.h', 'resource', 'OCPlatform_impl.h')
111 oclib_env.UserInstallTargetHeader(header_dir + 'WrapperFactory.h', 'resource', 'WrapperFactory.h')
112 oclib_env.UserInstallTargetHeader(header_dir + 'IClientWrapper.h', 'resource', 'IClientWrapper.h')
113 oclib_env.UserInstallTargetHeader(header_dir + 'IServerWrapper.h', 'resource', 'IServerWrapper.h')
114 oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcClientWrapper.h', 'resource', 'OutOfProcClientWrapper.h')
115 oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcServerWrapper.h', 'resource', 'OutOfProcServerWrapper.h')
116 oclib_env.UserInstallTargetHeader(header_dir + 'InProcClientWrapper.h', 'resource', 'InProcClientWrapper.h')
117 oclib_env.UserInstallTargetHeader(header_dir + 'InProcServerWrapper.h', 'resource', 'InProcServerWrapper.h')
118 oclib_env.UserInstallTargetHeader(header_dir + 'InitializeException.h', 'resource', 'InitializeException.h')
119 oclib_env.UserInstallTargetHeader(header_dir + 'ResourceInitException.h', 'resource', 'ResourceInitException.h')
121 oclib_env.UserInstallTargetHeader(header_dir + 'OCRepresentation.h', 'resource', 'OCRepresentation.h')
122 oclib_env.UserInstallTargetHeader(header_dir + 'AttributeValue.h', 'resource', 'AttributeValue.h')
124 oclib_env.UserInstallTargetHeader(header_dir + 'OCResource.h', 'resource', 'OCResource.h')
125 oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceRequest.h', 'resource', 'OCResourceRequest.h')
126 oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceResponse.h', 'resource', 'OCResourceResponse.h')
127 oclib_env.UserInstallTargetHeader(header_dir + 'OCUtilities.h', 'resource', 'OCUtilities.h')
129 oclib_env.UserInstallTargetHeader(header_dir + 'CAManager.h', 'resource', 'CAManager.h')
131 # Add Provisioning library
132 if target_os in ['linux', 'android', 'tizen'] and env.get('SECURED') == '1':
133 SConscript('../provisioning/SConscript')