##
Import('env')
+import os
+
# Add third party libraries
lib_env = env.Clone()
SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
oclib_env = lib_env.Clone()
+secured = lib_env.get('SECURED')
######################################################################
# Build flags
######################################################################
oclib_env.AppendUnique(CPPPATH = [
'../include/',
'../csdk/stack/include',
- '../csdk/ocrandom/include',
- '../csdk/ocmalloc/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 = ['oc_logger'])
+oclib_env.PrependUnique(LIBS = ['octbstack', 'connectivity_abstraction', 'ocsrm'])
+
target_os = env.get('TARGET_OS')
+if target_os == 'linux':
+ oclib_env.AppendUnique(LIBS = ['pthread'])
+
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(LIBPATH = [env.get('BUILD_DIR')])
- oclib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger', 'boost_thread', 'gnustl_static', '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 ['darwin', 'ios']:
- oclib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
- oclib_env.AppendUnique(LIBS = ['octbstack', 'oc_logger'])
+if target_os in ['linux'] and env.get('SIMULATOR', False):
+ oclib_env.Append( RPATH = env.Literal('\\$$ORIGIN'))
+
+if target_os in ['msys_nt', 'windows']:
+ oclib_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'oc_logger')])
+ oclib_env.AppendUnique(LIBPATH = [os.path.join(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'])
######################################################################
# Source files and Targets
'OCRepresentation.cpp',
'InProcServerWrapper.cpp',
'InProcClientWrapper.cpp',
- 'OCResourceRequest.cpp'
+ 'OCResourceRequest.cpp',
+ 'CAManager.cpp'
]
-oclib_env.AppendUnique(CPPPATH = [oclib_env.get('SRC_DIR') + '/extlibs/cereal/include'])
-oclib = oclib_env.SharedLibrary('oc', oclib_src)
-oclib_env.InstallTarget(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 = env.get('SRC_DIR') + '/resource/include/'
+
+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')
+# Add Provisioning library
+if target_os in ['linux', 'android', 'tizen'] and env.get('SECURED') == '1':
+ SConscript('../provisioning/SConscript')