##
# OCLib (share library) build script
##
-Import('env')
+import os
+thread_env = SConscript('#build_common/thread.scons')
+lib_env = thread_env.Clone()
# Add third party libraries
-lib_env = env.Clone()
-SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
+SConscript('#resource/third_party_libs.scons', 'lib_env')
oclib_env = lib_env.Clone()
+secured = lib_env.get('SECURED')
+target_os = oclib_env.get('TARGET_OS')
+
######################################################################
# Build flags
######################################################################
oclib_env.AppendUnique(CPPPATH = [
'../include/',
'../csdk/stack/include',
- '../csdk/ocrandom/include',
+ '../c_common/ocrandom/include',
'../csdk/logger/include',
'../oc_logger/include',
- '../csdk/connectivity/lib/libcoap-4.1.1'
+ '../csdk/connectivity/lib/libcoap-4.1.1',
+ '../csdk/connectivity/api'
])
-oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-
-oclib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])
+oclib_env.AppendUnique(LIBPATH = [oclib_env.get('BUILD_DIR')])
-target_os = env.get('TARGET_OS')
-if target_os == 'linux':
- oclib_env.AppendUnique(LIBS = ['pthread'])
+oclib_env.AppendUnique(LIBS = ['oc_logger'])
+oclib_env.PrependUnique(LIBS = ['octbstack', 'connectivity_abstraction', 'ocsrm'])
-if target_os not in ['windows', 'winrt']:
- oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
+if 'g++' in oclib_env.get('CXX'):
+ oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
+ oclib_env.AppendUnique(CXXFLAGS = ['-Wall'])
+ oclib_env.AppendUnique(CXXFLAGS = ['-fPIC'])
-if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
+if target_os not in ['darwin', 'ios', 'windows']:
oclib_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
if target_os == 'android':
- oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
- oclib_env.AppendUnique(LIBS = ['boost_thread', 'gnustl_shared', 'log'])
+ oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+ oclib_env.AppendUnique(LIBS = ['boost_thread', 'gnustl_shared', 'log'])
+ oclib_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,liboc.so'])
+
+if target_os == 'tizen':
+ oclib_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+
+if target_os in ['linux'] and oclib_env.get('SIMULATOR', False):
+ oclib_env.Append( RPATH = oclib_env.Literal('\\$$ORIGIN'))
+
+if target_os in ['msys_nt', 'windows']:
+ oclib_env.AppendUnique(LIBPATH = [os.path.join(oclib_env.get('BUILD_DIR'), 'resource', 'oc_logger')])
+ oclib_env.AppendUnique(LIBPATH = [os.path.join(oclib_env.get('BUILD_DIR'), 'resource', 'csdk')])
+ oclib_env.AppendUnique(LIBS=['octbstack', 'logger', 'oc_logger','connectivity_abstraction', 'ocsrm', 'c_common', 'routingmanager'])
+ oclib_env.AppendUnique(LIBS=[ 'coap', 'ws2_32' ,'iphlpapi'])
+ if secured == '1':
+ oclib_env.AppendUnique(LIBS=['tinydtls'])
+
+if oclib_env.get('WITH_CLOUD'):
+ oclib_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+
+if 'CLIENT' in oclib_env.get('RD_MODE'):
+ oclib_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
+if 'SERVER' in oclib_env.get('RD_MODE'):
+ oclib_env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
######################################################################
# Source files and Targets
'OCRepresentation.cpp',
'InProcServerWrapper.cpp',
'InProcClientWrapper.cpp',
- 'OCResourceRequest.cpp'
+ 'OCResourceRequest.cpp',
+ 'CAManager.cpp',
+ 'OCDirectPairing.cpp'
]
-oclib = oclib_env.SharedLibrary('oc', oclib_src)
-oclib_env.InstallTarget(oclib, 'liboc')
-oclib_env.UserInstallTargetLib(oclib, 'liboc')
+if target_os in ['windows']:
+ oclib_src = oclib_src + ['OCApi.cpp']
+ # TODO: Add OC_EXPORT prefixes to enable DLL generation
+ oclib = oclib_env.StaticLibrary('oc', oclib_src)
+else:
+ oclib = oclib_env.SharedLibrary('oc', oclib_src)
+oclib_env.InstallTarget(oclib, 'oc')
+oclib_env.UserInstallTargetLib(oclib, 'oc')
+header_dir = os.path.join(oclib_env.get('SRC_DIR') , 'resource' , 'include') + os.sep
+
+oclib_env.UserInstallTargetHeader(header_dir + 'OCApi.h', 'resource', 'OCApi.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCHeaderOption.h', 'resource', 'OCHeaderOption.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCException.h', 'resource', 'OCException.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'StringConstants.h', 'resource', 'StringConstants.h')
+
+oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform.h', 'resource', 'OCPlatform.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCPlatform_impl.h', 'resource', 'OCPlatform_impl.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'WrapperFactory.h', 'resource', 'WrapperFactory.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'IClientWrapper.h', 'resource', 'IClientWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'IServerWrapper.h', 'resource', 'IServerWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcClientWrapper.h', 'resource', 'OutOfProcClientWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OutOfProcServerWrapper.h', 'resource', 'OutOfProcServerWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'InProcClientWrapper.h', 'resource', 'InProcClientWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'InProcServerWrapper.h', 'resource', 'InProcServerWrapper.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'InitializeException.h', 'resource', 'InitializeException.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'ResourceInitException.h', 'resource', 'ResourceInitException.h')
+
+oclib_env.UserInstallTargetHeader(header_dir + 'OCRepresentation.h', 'resource', 'OCRepresentation.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'AttributeValue.h', 'resource', 'AttributeValue.h')
+
+oclib_env.UserInstallTargetHeader(header_dir + 'OCResource.h', 'resource', 'OCResource.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceRequest.h', 'resource', 'OCResourceRequest.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCResourceResponse.h', 'resource', 'OCResourceResponse.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCUtilities.h', 'resource', 'OCUtilities.h')
+
+oclib_env.UserInstallTargetHeader(header_dir + 'CAManager.h', 'resource', 'CAManager.h')
+oclib_env.UserInstallTargetHeader(header_dir + 'OCDirectPairing.h', 'resource', 'OCDirectPairing.h')
-if target_os in ['linux', 'android'] and env.get('SECURED') == '1':
+# Add Provisioning library
+if target_os in ['linux', 'android', 'tizen'] and secured == '1':
SConscript('../provisioning/SConscript')