######################################################################
with_upstream_libcoap = liboctbstack_env.get('WITH_UPSTREAM_LIBCOAP')
if with_upstream_libcoap == '1':
- # For bring up purposes only, we manually copy the forked version to where the unforked version is downloaded.
liboctbstack_env.PrependUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
else:
- # For bring up purposes only, the forked version will live here.
liboctbstack_env.PrependUnique(CPPPATH = ['#resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
liboctbstack_env.PrependUnique(CPPPATH = [
- '#/extlibs/timer/',
+ '#resource/c_common/octimer/include',
+ '#resource/c_common/ocatomic/include',
'#resource/csdk/logger/include',
'#resource/csdk/include',
'include',
'#resource/csdk/security/include',
'#resource/csdk/security/include/internal',
'#resource/csdk/security/provisioning/include',
+ '#resource/csdk/routing/include',
])
if 'SUB' in with_mq:
if target_os not in ['windows']:
liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
-liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-
-liboctbstack_env.PrependUnique(LIBS = ['ocsrm', 'coap', 'timer'])
+liboctbstack_env.PrependUnique(LIBS = ['ocsrm', 'coap'])
if target_os in ['linux'] and liboctbstack_env.get('SIMULATOR', False):
liboctbstack_env.Append( RPATH = liboctbstack_env.Literal('\\$$ORIGIN'))
if env.get('SECURED') == '1':
- liboctbstack_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
+ liboctbstack_env.AppendUnique(LIBS = ['mbedtls','mbedx509'])
+
+# c_common calls into mbedcrypto.
+liboctbstack_env.AppendUnique(LIBS = ['mbedcrypto'])
if target_os in ['android', 'linux', 'tizen', 'msys_nt', 'windows']:
liboctbstack_env.PrependUnique(LIBS = ['connectivity_abstraction'])
if target_os not in ['windows', 'msys_nt']:
liboctbstack_env.AppendUnique(LIBS = ['m'])
else:
- liboctbstack_env.AppendUnique(CCFLAGS=['/W3', '/WX'])
+ liboctbstack_env.AppendUnique(CCFLAGS=['/W4', '/WX'])
+
# octbstack.def specifies the list of functions exported by octbstack.dll.
liboctbstack_env.Replace(WINDOWS_INSERT_DEF = ['1'])
+ # On Windows, apps don't link directly with oc_logger. oc_logger is linked inside
+ # octbstack.dll and apps import its APIs by linking with octbstack.lib.
+ liboctbstack_env.PrependUnique(LIBS = ['oc_logger_internal'])
+
+ if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
+ # On Windows:
+ # - octbstack.dll is exporting resource_directory C APIs
+ # - resource_directory.lib contains just the implementation of the C++ RD APIs
+ liboctbstack_env.PrependUnique(LIBS = ['resource_directory_internal'])
+
+ if 'CLIENT' in rd_mode:
+ liboctbstack_env.Textfile(target = 'octbstack_temp1.def', source = [File('octbstack_product.def'), File('octbstack_rd_client.def')])
+ else:
+ liboctbstack_env.Textfile(target = 'octbstack_temp1.def', source = [File('octbstack_product.def')])
+
+ if 'SERVER' in rd_mode:
+ liboctbstack_env.Textfile(target = 'octbstack_temp2.def', source = [File('octbstack_temp1.def'), File('octbstack_rd_server.def')])
+ else:
+ liboctbstack_env.Textfile(target = 'octbstack_temp2.def', source = [File('octbstack_temp1.def')])
+
if env.get('SECURED') != '1':
- liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_product.def')])
+ liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp2.def')])
else:
- # octbstack.dll is exporting ocpmapi APIs on Windows - there is no ocpmapi.dll.
- liboctbstack_env.PrependUnique(LIBS = ['ocpmapi'])
+ # On Windows, apps don't link directly with ocpmapi.lib. ocpmapi is linked
+ # inside octbstack.dll and apps import its APIs by linking with octbstack.lib.
+ liboctbstack_env.PrependUnique(LIBS = ['ocpmapi_internal'])
+
+ liboctbstack_env.Textfile(target = 'octbstack_temp3.def', source = [File('octbstack_temp2.def'), File('octbstack_product_secured.def')])
if with_tcp == True:
- liboctbstack_env.Textfile(target = 'octbstack_temp.def', source = [File('octbstack_product.def'), File('octbstack_product_with_tcp.def')])
+ liboctbstack_env.Textfile(target = 'octbstack_temp4.def', source = [File('octbstack_temp3.def'), File('octbstack_product_with_tcp.def')])
else:
- liboctbstack_env.Textfile(target = 'octbstack_temp.def', source = [File('octbstack_product.def')])
+ liboctbstack_env.Textfile(target = 'octbstack_temp4.def', source = [File('octbstack_temp3.def')])
if env.get('MULTIPLE_OWNER') == '1':
- liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp.def'), File('octbstack_product_secured.def'), File('octbstack_product_secured_mot.def')])
+ liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp4.def'), File('octbstack_product_secured_mot.def')])
else:
- liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp.def'), File('octbstack_product_secured.def')])
+ liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp4.def')])
if target_os in ['tizen', 'linux']:
liboctbstack_env.ParseConfig("pkg-config --cflags --libs uuid")
if target_os in ['darwin', 'ios']:
env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
- liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
if target_os not in ['arduino', 'windows']:
liboctbstack_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
if target_os == 'android':
if env.get('LOGGING'):
liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
-liboctbstack_env.Append(LIBS = ['c_common'])
-
if liboctbstack_env.get('ROUTING') in ['GW', 'EP']:
liboctbstack_env.Prepend(LIBS = ['routingmanager'])
if target_os not in ['linux', 'tizen', 'windows']:
liboctbstack_src.append('#extlibs/sqlite3/sqlite3.c')
-if target_os in ['linux']:
- # Linux uses a Shared library because SCons chooses the shared library on Linux
- # when only 'octbstack' is added to the LIBS.
- # TODO: Switch Linux to use a Static library for testing like every other OS.
- test_liboctbstack = liboctbstack_env.SharedLibrary('octbstack_test', liboctbstack_src)
-else:
- test_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_test', liboctbstack_src)
-
-octbstack_libs = Flatten(test_liboctbstack)
+internal_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_internal', liboctbstack_src)
+octbstack_libs = Flatten(internal_liboctbstack)
-if target_os in ['windows', 'msys_nt']:
- # Avoid a name conflict with the octbstack.lib target of the SharedLibrary.
- static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_static', liboctbstack_src)
-else:
- static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
-
-octbstack_libs += Flatten(static_liboctbstack)
-
-if target_os not in ['arduino','darwin','ios'] :
+if target_os not in ['arduino', 'darwin', 'ios'] :
shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
octbstack_libs += Flatten(shared_liboctbstack)
liboctbstack_env.UserInstallTargetHeader('include/ocstack.h', 'resource', 'ocstack.h')
liboctbstack_env.UserInstallTargetHeader('include/ocpresence.h', 'resource', 'ocpresence.h')
+if target_os not in ['windows', 'msys_nt']:
+ static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
+ octbstack_libs += Flatten(static_liboctbstack)
+
liboctbstack_env.InstallTarget(octbstack_libs, 'octbstack')
liboctbstack_env.UserInstallTargetLib(octbstack_libs, 'octbstack')