+#******************************************************************
+#
+# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
##
-# OCLib (static library) build script
+# OCLib (share library) build script
##
-Import('env', 'BUILD_TARGET', 'BUILD_DIR', 'SRC_TOP_DIR')
+Import('env')
# Add third party libraries
-SConscript(SRC_TOP_DIR + '/third_party_libs.scons')
-
-oclib_env = env.Clone()
+lib_env = env.Clone()
+SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
+oclib_env = lib_env.Clone()
######################################################################
# Build flags
######################################################################
oclib_env.AppendUnique(CPPPATH = [
'../include/',
'../csdk/stack/include',
- '../csdk/ocsocket/include',
'../csdk/ocrandom/include',
'../csdk/logger/include',
- '../csdk/libcoap',
- '../oc_logger/include'
+ '../oc_logger/include',
+ '../csdk/connectivity/lib/libcoap-4.1.1'
])
-if BUILD_TARGET not in ['windows', 'winrt']:
- oclib_env.AppendUnique(CXXFLAGS = ['-std=c++11', '-Wall'])
+oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+
+oclib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])
+
+target_os = env.get('TARGET_OS')
+if target_os == 'linux':
+ oclib_env.AppendUnique(LIBS = ['pthread'])
-if BUILD_TARGET == 'android':
+if target_os not in ['windows', 'winrt']:
+ oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
+
+if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
+ oclib_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+
+if target_os == 'android':
oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
- oclib_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
+ oclib_env.AppendUnique(LIBS = ['boost_thread', 'gnustl_shared', 'log'])
######################################################################
# Source files and Targets
######################################################################
oclib_src = [
'OCPlatform.cpp',
+ 'OCPlatform_impl.cpp',
'OCResource.cpp',
'OCUtilities.cpp',
'OCException.cpp',
+ 'OCRepresentation.cpp',
'InProcServerWrapper.cpp',
- 'InProcClientWrapper.cpp'
+ 'InProcClientWrapper.cpp',
+ 'OCResourceRequest.cpp'
]
-oclib = oclib_env.StaticLibrary('oc', oclib_src)
-i_ocl = oclib_env.Install(BUILD_DIR, oclib)
-Alias('liboc', i_ocl)
-env.AppendUnique(TS = ['liboc'])
\ No newline at end of file
+oclib = oclib_env.SharedLibrary('oc', oclib_src)
+oclib_env.InstallTarget(oclib, 'liboc')
+oclib_env.UserInstallTargetLib(oclib, 'liboc')
+
+src_dir = env.get('SRC_DIR')
+
+oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCApi.h', 'resource', 'OCApi.h')
+oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCPlatform.h', 'resource', 'OCPlatform.h')
+oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCRepresentation.h', 'resource', 'OCRepresentation.h')
+oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCResource.h', 'resource', 'OCResource.h')
+oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCResourceRequest.h', 'resource', 'OCResourceRequest.h')
+oclib_env.UserInstallTargetHeader(src_dir + '/resource/include/OCResourceResponse.h', 'resource', 'OCResourceResponse.h')