liboctbstack_env = env.Clone()
# Build C Samples
-SConscript('samples/SConscript', exports = { 'stacksamples_env' : liboctbstack_env })
+SConscript('samples/SConscript',
+ exports={'stacksamples_env': liboctbstack_env})
-SConscript('#resource/third_party_libs.scons', exports = { 'lib_env' : liboctbstack_env })
+SConscript('#/resource/third_party_libs.scons',
+ exports={'lib_env': liboctbstack_env})
target_os = env.get('TARGET_OS')
rd_mode = env.get('RD_MODE')
# As in the source code, it includes arduino Time library (C++)
# It requires compile the .c with g++
if target_os == 'arduino':
- liboctbstack_env.Replace(CC = env.get('CXX'))
- liboctbstack_env.Replace(CFLAGS = env.get('CXXFLAGS'))
+ liboctbstack_env.Replace(CC=env.get('CXX'))
+ liboctbstack_env.Replace(CFLAGS=env.get('CXXFLAGS'))
######################################################################
# Build flags
######################################################################
with_upstream_libcoap = liboctbstack_env.get('WITH_UPSTREAM_LIBCOAP')
if with_upstream_libcoap == '1':
- liboctbstack_env.PrependUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+ liboctbstack_env.PrependUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
else:
- liboctbstack_env.PrependUnique(CPPPATH = ['#resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
-
-liboctbstack_env.PrependUnique(CPPPATH = [
- '#resource/c_common/octimer/include',
- '#resource/c_common/ocatomic/include',
- '#resource/csdk/logger/include',
- '#resource/csdk/include',
- 'include',
- 'include/internal',
- '#resource/oc_logger/include',
- '#resource/csdk/connectivity/common/inc',
- '#resource/csdk/connectivity/inc',
- '#resource/csdk/connectivity/inc/pkix',
- '#resource/csdk/connectivity/api',
- '#resource/csdk/connectivity/external/inc',
- '#resource/csdk/security/include',
- '#resource/csdk/security/include/internal',
- '#resource/csdk/security/provisioning/include',
- '#resource/csdk/routing/include',
- ])
+ liboctbstack_env.PrependUnique(CPPPATH=['#resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
+
+liboctbstack_env.PrependUnique(CPPPATH=[
+ '#resource/c_common/octimer/include',
+ '#resource/c_common/ocatomic/include',
+ '#resource/csdk/logger/include',
+ '#resource/csdk/include',
+ 'include',
+ 'include/internal',
+ '#resource/oc_logger/include',
+ '#resource/csdk/connectivity/common/inc',
+ '#resource/csdk/connectivity/inc',
+ '#resource/csdk/connectivity/inc/pkix',
+ '#resource/csdk/connectivity/api',
+ '#resource/csdk/connectivity/external/inc',
+ '#resource/csdk/security/include',
+ '#resource/csdk/security/include/internal',
+ '#resource/csdk/security/provisioning/include',
+ '#resource/csdk/routing/include',
+])
if 'SUB' in with_mq:
- liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
if 'PUB' in with_mq:
- liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
if 'BROKER' in with_mq:
- liboctbstack_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
if target_os not in ['arduino', 'windows']:
- liboctbstack_env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '_GNU_SOURCE'])
- liboctbstack_env.AppendUnique(CFLAGS = ['-std=c99'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['WITH_POSIX', '_GNU_SOURCE'])
+ liboctbstack_env.AppendUnique(CFLAGS=['-std=c99'])
if liboctbstack_env.get('ROUTING') == 'GW':
- liboctbstack_env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['ROUTING_GATEWAY'])
elif liboctbstack_env.get('ROUTING') == 'EP':
- liboctbstack_env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['ROUTING_EP'])
if target_os not in ['windows']:
- liboctbstack_env.AppendUnique(CFLAGS = ['-Wall'])
+ liboctbstack_env.AppendUnique(CFLAGS=['-Wall'])
-liboctbstack_env.PrependUnique(LIBS = ['ocsrm', 'coap'])
+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'))
+ liboctbstack_env.Append(RPATH=liboctbstack_env.Literal('\\$$ORIGIN'))
if env.get('SECURED') == '1':
- liboctbstack_env.AppendUnique(LIBS = ['mbedtls','mbedx509'])
+ liboctbstack_env.AppendUnique(LIBS=['mbedtls', 'mbedx509'])
# c_common calls into mbedcrypto.
-liboctbstack_env.AppendUnique(LIBS = ['mbedcrypto'])
+liboctbstack_env.AppendUnique(LIBS=['mbedcrypto'])
if target_os in ['android', 'linux', 'tizen', 'msys_nt', 'windows']:
if target_os not in ['windows', 'msys_nt']:
- liboctbstack_env.PrependUnique(LIBS = ['connectivity_abstraction'])
+ liboctbstack_env.PrependUnique(LIBS=['connectivity_abstraction'])
else:
# On Windows, apps don't link directly with connectivity_abstraction.
# connectivity_abstraction is linked inside octbstack.dll and apps
# import its APIs by linking with octbstack.lib.
- liboctbstack_env.PrependUnique(LIBS = ['connectivity_abstraction_internal'])
+ liboctbstack_env.PrependUnique(LIBS=['connectivity_abstraction_internal'])
if with_ra_ibb:
- liboctbstack_env.AppendUnique(LIBS = liboctbstack_env['RALIBS'], LIBPATH = liboctbstack_env['RALIBPATH'], RPATH = liboctbstack_env['RARPATH'])
- else :
+ liboctbstack_env.AppendUnique(
+ LIBS=liboctbstack_env['RALIBS'],
+ LIBPATH=liboctbstack_env['RALIBPATH'],
+ RPATH=liboctbstack_env['RARPATH'])
+ else:
if with_ra:
- liboctbstack_env.AppendUnique(LIBS = ['ra_xmpp'])
+ liboctbstack_env.AppendUnique(LIBS=['ra_xmpp'])
if target_os not in ['windows', 'msys_nt']:
- liboctbstack_env.AppendUnique(LIBS = ['m'])
+ liboctbstack_env.AppendUnique(LIBS=['m'])
else:
# octbstack.def specifies the list of functions exported by octbstack.dll.
- liboctbstack_env.Replace(WINDOWS_INSERT_DEF = ['1'])
+ 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'])
+ 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'])
+ 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')])
+ 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')])
+ 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')])
+ 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')])
+ 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_temp2.def')])
+ liboctbstack_env.Textfile(
+ target='octbstack.def', source=[File('octbstack_temp2.def')])
else:
# 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.PrependUnique(LIBS=['ocpmapi_internal'])
- liboctbstack_env.Textfile(target = 'octbstack_temp3.def', source = [File('octbstack_temp2.def'), File('octbstack_product_secured.def')])
+ liboctbstack_env.Textfile(
+ target='octbstack_temp3.def',
+ source=[
+ File('octbstack_temp2.def'),
+ File('octbstack_product_secured.def')
+ ])
if env.get('MULTIPLE_OWNER') == '1':
- liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp3.def'), File('octbstack_product_secured_mot.def')])
+ liboctbstack_env.Textfile(
+ target='octbstack.def',
+ source=[
+ File('octbstack_temp3.def'),
+ File('octbstack_product_secured_mot.def')
+ ])
else:
- liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_temp3.def')])
+ liboctbstack_env.Textfile(
+ target='octbstack.def', source=[File('octbstack_temp3.def')])
if target_os in ['tizen', 'linux']:
liboctbstack_env.ParseConfig("pkg-config --cflags --libs uuid")
liboctbstack_env.ParseConfig('pkg-config --cflags --libs sqlite3')
if target_os == 'arduino':
- liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
-elif target_os not in ['darwin','ios', 'msys_nt', 'windows']:
- liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['NDEBUG', 'WITH_ARDUINO'])
+elif target_os not in ['darwin', 'ios', 'msys_nt', 'windows']:
+ liboctbstack_env.AppendUnique(CFLAGS=['-fPIC'])
if target_os in ['darwin', 'ios']:
- env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
- liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+ env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
if target_os not in ['arduino', 'windows']:
- liboctbstack_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+ liboctbstack_env.AppendUnique(LINKFLAGS=['-Wl,--no-undefined'])
if target_os == 'android':
- liboctbstack_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,liboctbstack.so'])
+ liboctbstack_env.AppendUnique(LINKFLAGS=['-Wl,-soname,liboctbstack.so'])
if env.get('LOGGING'):
- liboctbstack_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['TB_LOG'])
if liboctbstack_env.get('ROUTING') in ['GW', 'EP']:
- liboctbstack_env.Prepend(LIBS = ['routingmanager'])
+ liboctbstack_env.Prepend(LIBS=['routingmanager'])
if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
- liboctbstack_env.PrependUnique(CPPPATH = ['#resource/csdk/resource-directory/include'])
+ liboctbstack_env.PrependUnique(CPPPATH=['#resource/csdk/resource-directory/include'])
if target_os in ['windows']:
- liboctbstack_env.AppendUnique(LIBS = ['sqlite3'])
+ liboctbstack_env.AppendUnique(LIBS=['sqlite3'])
if 'CLIENT' in rd_mode:
- liboctbstack_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['RD_CLIENT'])
if 'SERVER' in rd_mode:
- liboctbstack_env.AppendUnique(CPPDEFINES = ['RD_SERVER'])
+ liboctbstack_env.AppendUnique(CPPDEFINES=['RD_SERVER'])
if target_os in ['tizen']:
liboctbstack_env.ParseConfig('pkg-config --cflags --libs sqlite3')
else:
- liboctbstack_env.AppendUnique(CPPPATH = ['#extlibs/sqlite3'])
+ liboctbstack_env.AppendUnique(CPPPATH=['#extlibs/sqlite3'])
######################################################################
# Source files and Targets
OCTBSTACK_SRC + 'occollection.c',
OCTBSTACK_SRC + 'oicgroup.c',
OCTBSTACK_SRC + 'ocendpoint.c'
- ]
+]
if with_tcp == True:
liboctbstack_src.append(OCTBSTACK_SRC + 'oickeepalive.c')
if ((target_os in ['windows']) and (liboctbstack_env.get('UWP_APP') == '1')):
liboctbstack_src.append(OCTBSTACK_SRC + 'ocsqlite3helper.c')
-internal_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_internal', liboctbstack_src)
+internal_liboctbstack = liboctbstack_env.StaticLibrary(
+ 'octbstack_internal', liboctbstack_src)
octbstack_libs = Flatten(internal_liboctbstack)
-if target_os not in ['arduino', 'darwin', 'ios'] :
- shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
+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/stack', 'ocstack.h')
liboctbstack_env.UserInstallTargetHeader('include/ocpresence.h', 'resource/stack', 'ocpresence.h')
if target_os not in ['windows', 'msys_nt']:
- static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
+ static_liboctbstack = liboctbstack_env.StaticLibrary(
+ 'octbstack', liboctbstack_src)
octbstack_libs += Flatten(static_liboctbstack)
liboctbstack_env.InstallTarget(octbstack_libs, 'octbstack')
# Build linux samples for now
SConscript('linux/SimpleClientServer/SConscript', 'stacksamples_env')
elif target_os == 'arduino':
- SConscript('arduino/SimpleClientServer/ocserver/SConscript', 'stacksamples_env')
+ SConscript('arduino/SimpleClientServer/ocserver/SConscript',
+ 'stacksamples_env')
elif target_os == 'msys_nt':
# Build secure samples. Using linux samples for now.
SConscript('linux/secure/SConscript', 'stacksamples_env')
######################################################################
# Build flags
######################################################################
-arduino_simplecs_env.PrependUnique(CPPPATH = [
- '../../../../../logger/include',
- '../../../../../include',
- '../../../../../stack/include',
- '../../../../../../oc_logger/include'
- ])
+arduino_simplecs_env.PrependUnique(CPPPATH=[
+ '../../../../../logger/include',
+ '../../../../../include',
+ '../../../../../stack/include',
+ '../../../../../../oc_logger/include'
+])
-arduino_simplecs_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+arduino_simplecs_env.AppendUnique(CPPDEFINES=['TB_LOG'])
-arduino_simplecs_env.PrependUnique(
- LIBS = ['octbstack', 'ocsrm', 'routingmanager', 'connectivity_abstraction','coap'])
+arduino_simplecs_env.PrependUnique(LIBS=[
+ 'octbstack',
+ 'ocsrm',
+ 'routingmanager',
+ 'connectivity_abstraction',
+ 'coap'
+])
arduino_simplecs = arduino_simplecs_env.Program('SimpleClientServer', 'ocserver.cpp')
arduino_simplecs_env.CreateBin('SimpleClientServer')
-i_arduino_simplecs = arduino_simplecs_env.Install(arduino_simplecs_env.get('BUILD_DIR'), arduino_simplecs)
+i_arduino_simplecs = arduino_simplecs_env.Install(
+ arduino_simplecs_env.get('BUILD_DIR'), arduino_simplecs)
#The map file is intermediate file, make sure it's removed when clean build
arduino_simplecs_env.Clean(arduino_simplecs, 'SimpleClientServer.map')
Alias('arduino_simplecs', i_arduino_simplecs)
arduino_simplecs_env.AppendTarget('arduino_simplecs')
-if(arduino_simplecs_env['UPLOAD'] == True):
- if sys.platform.startswith("linux"):
- arduino_simplecs_env.Upload(arduino_simplecs_env.get('BUILD_DIR') + '/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SimpleClientServer.hex')
- else:
- print 'Please use appropriate install method for your development machine. Linux is the only supported platform right now.'
+if (arduino_simplecs_env['UPLOAD'] == True):
+ if sys.platform.startswith("linux"):
+ arduino_simplecs_env.Upload(
+ arduino_simplecs_env.get('BUILD_DIR') + '/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SimpleClientServer.hex')
+ else:
+ print 'Please use appropriate install method for your development machine. Linux is the only supported platform right now.'
######################################################################
# Build flags
######################################################################
-ocsample_env.PrependUnique(CPPPATH = [
+ocsample_env.PrependUnique(CPPPATH=[
'#/resource/csdk/include',
'#/resource/csdk/stack/include',
])
if target_os not in ['msys_nt', 'windows']:
- ocsample_env.PrependUnique(LIBS = [
- 'connectivity_abstraction',
- ])
+ ocsample_env.PrependUnique(LIBS=['connectivity_abstraction',])
-ocsample_env.PrependUnique(LIBS = [
- 'octbstack',
-])
+ocsample_env.PrependUnique(LIBS=['octbstack',])
if ocsample_env.get('SECURED') == '1':
- if ocsample_env.get('WITH_TCP') == True:
- ocsample_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
+ if ocsample_env.get('WITH_TCP') == True:
+ ocsample_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
-ocsample_env.AppendUnique(LIBPATH = [
- ocsample_env.get('BUILD_DIR'),
-])
+ocsample_env.AppendUnique(LIBPATH=[ocsample_env.get('BUILD_DIR'),])
######################################################################
# Source files and Targets
######################################################################
with_upstream_libcoap = samples_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.
- samples_env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
+ samples_env.AppendUnique(CPPPATH=['#/extlibs/libcoap/libcoap/include'])
else:
- # For bring up purposes only, the forked version will live here.
- samples_env.AppendUnique(CPPPATH=['#resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
+ samples_env.AppendUnique(CPPPATH=['#/resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
samples_env.PrependUnique(CPPPATH=[
'../../../../logger/include',
sample_build_dir = samples_env.get(
'BUILD_DIR') + '/resource/csdk/stack/samples/linux/SimpleClientServer/'
+introspectionDat = samples_env.Install(
+ sample_build_dir, sample_src_dir + 'introspection.dat')
-introspectionDat = samples_env.Install(sample_build_dir,
- sample_src_dir + 'introspection.dat')
-
-deviceProperties = samples_env.Install(sample_build_dir,
- sample_src_dir + 'device_properties.dat')
-
+deviceProperties = samples_env.Install(
+ sample_build_dir, sample_src_dir + 'device_properties.dat')
######################################################################
# Source files and Targets
occlientbasicops = samples_env.Program(
'occlientbasicops', ['occlientbasicops.cpp', 'common.cpp'])
if with_ra:
- ocremoteaccessclient = samples_env.Program('ocremoteaccessclient',
- ['ocremoteaccessclient.cpp', 'common.cpp'])
-
-list_of_samples = [ocserver, occlient,
- ocservercoll, occlientcoll,
- ocserverbasicops, occlientbasicops,
- ocserverslow, occlientslow
- ]
+ ocremoteaccessclient = samples_env.Program(
+ 'ocremoteaccessclient', ['ocremoteaccessclient.cpp', 'common.cpp'])
+
+list_of_samples = [
+ ocserver,
+ occlient,
+ ocservercoll,
+ occlientcoll,
+ ocserverbasicops,
+ occlientbasicops,
+ ocserverslow,
+ occlientslow
+]
if with_ra:
list_of_samples.append(ocremoteaccessclient)
Alias("samples", list_of_samples)
######################################################################
# Build flags
######################################################################
-samples_env.PrependUnique(CPPPATH = [
- '../../../../logger/include',
- '../../../../include',
- '../../../../stack/include',
- '../../../../security/include',
- '../../../../../oc_logger/include'
- ])
+samples_env.PrependUnique(CPPPATH=[
+ '../../../../logger/include',
+ '../../../../include',
+ '../../../../stack/include',
+ '../../../../security/include',
+ '../../../../../oc_logger/include'
+])
target_os = samples_env.get('TARGET_OS')
if target_os not in ['windows']:
- samples_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
+ samples_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-pthread'])
- # Note: 'pthread' is in libc for android.
- if target_os != 'android':
- samples_env.AppendUnique(LIBS = ['pthread'])
- samples_env.Append(LINKFLAGS = ['-Wl,--no-as-needed'])
+ # Note: 'pthread' is in libc for android.
+ if target_os != 'android':
+ samples_env.AppendUnique(LIBS=['pthread'])
+ samples_env.Append(LINKFLAGS=['-Wl,--no-as-needed'])
if target_os in ['windows', 'msys_nt']:
- samples_env.PrependUnique(LIBS = ['coap', 'ocsrm'])
+ samples_env.PrependUnique(LIBS=['coap', 'ocsrm'])
else:
- samples_env.PrependUnique(LIBS = ['connectivity_abstraction', 'coap', 'm'])
+ samples_env.PrependUnique(LIBS=['connectivity_abstraction', 'coap', 'm'])
-samples_env.PrependUnique(LIBS = ['octbstack'])
+samples_env.PrependUnique(LIBS=['octbstack'])
if samples_env.get('SECURED') == '1':
- samples_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
-
+ samples_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
if target_os == 'android':
- samples_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
- samples_env.AppendUnique(LIBS = ['gnustl_shared'])
- samples_env.AppendUnique(CPPDEFINES = ['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
+ samples_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+ samples_env.AppendUnique(LIBS=['gnustl_shared'])
+ samples_env.AppendUnique(
+ CPPDEFINES=['_GLIBCXX_USE_C99=1', '_GLIBCXX_HAVE_WCSTOF=1'])
- if not samples_env.get('RELEASE'):
- samples_env.AppendUnique(LIBS = ['log'])
+ if not samples_env.get('RELEASE'):
+ samples_env.AppendUnique(LIBS=['log'])
if target_os in ['darwin', 'ios']:
- samples_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+ samples_env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
-samples_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+samples_env.AppendUnique(CPPDEFINES=['TB_LOG'])
######################################################################
# Source files and Targets
######################################################################
-ocserverbasicops = samples_env.Program('ocserverbasicops', ['common.cpp', 'ocserverbasicops.cpp'])
-occlientbasicops = samples_env.Program('occlientbasicops', ['common.cpp', 'occlientbasicops.cpp'])
-ocamsservice = samples_env.Program('ocamsservice', ['common.cpp', 'ocamsservice.cpp'])
+ocserverbasicops = samples_env.Program(
+ 'ocserverbasicops', ['common.cpp', 'ocserverbasicops.cpp'])
+occlientbasicops = samples_env.Program(
+ 'occlientbasicops', ['common.cpp', 'occlientbasicops.cpp'])
+ocamsservice = samples_env.Program(
+ 'ocamsservice', ['common.cpp', 'ocamsservice.cpp'])
+ocsamples = [ocserverbasicops, occlientbasicops, ocamsservice]
if samples_env.get('SECURED') == '1':
- occlientdirectpairing = samples_env.Program('occlientdirectpairing', 'occlientdirectpairing.cpp')
- Alias("samples", [ocserverbasicops, occlientbasicops, ocamsservice, occlientdirectpairing])
-else:
- Alias("samples", [ocserverbasicops, occlientbasicops, ocamsservice])
-
+ occlientdirectpairing = samples_env.Program(
+ 'occlientdirectpairing', 'occlientdirectpairing.cpp')
+ ocsamples.append(occlientdirectpairing)
+Alias("samples", ocsamples)
samples_env.AppendTarget('samples')
src_dir = samples_env.get('SRC_DIR')
sec_samples_src_dir = src_dir + '/resource/csdk/stack/samples/linux/secure/'
-sec_samples_build_dir = samples_env.get('BUILD_DIR') +'/resource/csdk/stack/samples/linux/secure'
-
-samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_svr_db_server.json'))
-samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_svr_db_client_devowner.json'))
-samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_svr_db_client_nondevowner.json'))
-samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_amss_db.json'))
+sec_samples_build_dir = samples_env.get(
+ 'BUILD_DIR') + '/resource/csdk/stack/samples/linux/secure'
+
+samples_env.Alias(
+ "install",
+ samples_env.Install(sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_svr_db_server.json'))
+samples_env.Alias(
+ "install",
+ samples_env.Install(sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_svr_db_client_devowner.json'))
+samples_env.Alias(
+ "install",
+ samples_env.Install(sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_svr_db_client_nondevowner.json'))
+samples_env.Alias(
+ "install",
+ samples_env.Install(sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_amss_db.json'))
if samples_env.get('SECURED') == '1':
- samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_svr_db_client_directpairing.json'))
- samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_svr_db_client_directpairing.dat'))
-
-samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_svr_db_server.dat'))
-samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_svr_db_client_devowner.dat'))
-samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_svr_db_client_nondevowner.dat'))
-samples_env.Alias("install", samples_env.Install( sec_samples_build_dir,
- sec_samples_src_dir + 'oic_amss_db.dat'))
+ samples_env.Alias(
+ "install",
+ samples_env.Install(
+ sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_svr_db_client_directpairing.json'))
+ samples_env.Alias(
+ "install",
+ samples_env.Install(
+ sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_svr_db_client_directpairing.dat'))
+
+samples_env.Alias(
+ "install",
+ samples_env.Install(sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_svr_db_server.dat'))
+samples_env.Alias(
+ "install",
+ samples_env.Install(sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_svr_db_client_devowner.dat'))
+samples_env.Alias(
+ "install",
+ samples_env.Install(sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_svr_db_client_nondevowner.dat'))
+samples_env.Alias(
+ "install",
+ samples_env.Install(sec_samples_build_dir,
+ sec_samples_src_dir + 'oic_amss_db.dat'))
print "Inside the Config SConscript"
# Map of host os and allowed target os (host: allowed target os)
host_target_map = {
- 'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
- 'windows': ['windows', 'android', 'arduino', 'tizen'],
- 'darwin': ['darwin', 'ios', 'android', 'arduino'],
- }
+ 'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
+ 'windows': ['windows', 'android', 'arduino', 'tizen'],
+ 'darwin': ['darwin', 'ios', 'android', 'arduino'],
+}
# Map of os and allowed archs (os: allowed archs)
os_arch_map = {
- 'linux': ['x86', 'x86_64', 'arm', 'arm64'],
- 'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
- 'windows': ['x86', 'amd64', 'arm'],
- 'darwin': ['i386', 'x86_64'],
- 'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
- 'arduino': ['avr', 'arm'],
- 'yocto': ['x86', 'x86_64'],
- 'tizen': ['armv7'],
- }
+ 'linux': ['x86', 'x86_64', 'arm', 'arm64'],
+ 'android': [
+ 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard',
+ 'arm64-v8a'
+ ],
+ 'windows': ['x86', 'amd64', 'arm'],
+ 'darwin': ['i386', 'x86_64'],
+ 'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
+ 'arduino': ['avr', 'arm'],
+ 'yocto': ['x86', 'x86_64'],
+ 'tizen': ['armv7'],
+}
host = platform.system().lower()
if host not in host_target_map:
- print "\nError: Current system (%s) isn't supported\n" % host
- Exit(1)
+ print "\nError: Current system (%s) isn't supported\n" % host
+ Exit(1)
######################################################################
# Get build options (the optins from command line)
######################################################################
-target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os
+target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os
if target_os not in host_target_map[host]:
- print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host])
- Exit(1)
+ print "\nError: Unknown target os: %s (Allow values: %s)\n" % (
+ target_os, host_target_map[host])
+ Exit(1)
default_arch = platform.machine()
if default_arch not in os_arch_map[target_os]:
- default_arch = os_arch_map[target_os][0].lower()
+ default_arch = os_arch_map[target_os][0].lower()
target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch
# Common build options (release, target os, target arch)
######################################################################
help_vars = Variables()
-help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
-help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
-help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'IP', 'BT', 'BLE']))
-help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os]))
-help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '1', allowed_values=('0', '1')))
-help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
-help_vars.Add(BoolVariable('WITH_PROXY', 'CoAP-HTTP Proxy', False)) # set to 'no', 'false' or 0 for debug
-help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/subscriber/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
+help_vars.Add(
+ BoolVariable('RELEASE',
+ 'Build for release?',
+ True)) # set to 'no', 'false' or 0 for debug
+help_vars.Add(
+ EnumVariable('TARGET_OS',
+ 'Target platform',
+ host,
+ allowed_values=host_target_map[host]))
+help_vars.Add(
+ ListVariable('TARGET_TRANSPORT',
+ 'Target transport',
+ 'ALL',
+ ['ALL', 'IP', 'BT', 'BLE']))
+help_vars.Add(
+ EnumVariable('TARGET_ARCH',
+ 'Target architecture',
+ default_arch,
+ allowed_values=os_arch_map[target_os]))
+help_vars.Add(
+ EnumVariable('SECURED',
+ 'Build with DTLS',
+ '1',
+ allowed_values=('0', '1')))
+help_vars.Add(
+ EnumVariable('ROUTING',
+ 'Enable routing',
+ 'EP',
+ allowed_values=('GW', 'EP')))
+help_vars.Add(
+ BoolVariable('WITH_PROXY',
+ 'CoAP-HTTP Proxy',
+ False)) # set to 'no', 'false' or 0 for debug
+help_vars.Add(
+ ListVariable('WITH_MQ',
+ 'Build with MQ publisher/subscriber/broker',
+ 'OFF',
+ ['OFF', 'SUB', 'PUB', 'BROKER']))
######################################################################
# Platform(build target) specific options: SDK/NDK & toolchain
targets_support_cc = ['linux', 'arduino', 'tizen']
if target_os in targets_support_cc:
- # Set cross compile toolchain
- help_vars.Add('TC_PREFIX', "Toolchain prefix (Generally only be required for cross-compiling)", os.environ.get('TC_PREFIX'))
- help_vars.Add(PathVariable('TC_PATH',
- 'Toolchain path (Generally only be required for cross-compiling)',
- os.environ.get('TC_PATH')))
-
-if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compiler regardless of the host
- env = Environment(variables = help_vars,
- tools = ['gnulink', 'gcc', 'g++', 'ar', 'as']
- )
+ # Set cross compile toolchain
+ help_vars.Add(
+ 'TC_PREFIX',
+ "Toolchain prefix (Generally only required for cross-compiling)",
+ os.environ.get('TC_PREFIX'))
+ help_vars.Add(
+ PathVariable(
+ 'TC_PATH',
+ 'Toolchain path (Generally only required for cross-compiling)',
+ os.environ.get('TC_PATH')))
+
+if target_os in [
+ 'android', 'arduino'
+]: # Android/Arduino always uses GNU compiler regardless of the host
+ env = Environment(
+ variables=help_vars, tools=['gnulink', 'gcc', 'g++', 'ar', 'as'])
else:
- env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os)
+ env = Environment(
+ variables=help_vars, TARGET_ARCH=target_arch, TARGET_OS=target_os)
Help(help_vars.GenerateHelpText(env))
'''
if target_os in targets_support_cc:
- prefix = env.get('TC_PREFIX')
- tc_path = env.get('TC_PATH')
- if prefix:
- env.Replace(CC = prefix + 'gcc')
- env.Replace(CXX = prefix + 'g++')
- env.Replace(AR = prefix + 'ar')
- env.Replace(AS = prefix + 'as')
- env.Replace(LINK = prefix + 'ld')
- env.Replace(RANLIB = prefix + 'ranlib')
-
- if tc_path:
- env.PrependENVPath('PATH', tc_path)
- sys_root = os.path.abspath(tc_path + '/../')
- env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root])
- env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root])
-
- if prefix or tc_path:
- print tc_set_msg
+ prefix = env.get('TC_PREFIX')
+ tc_path = env.get('TC_PATH')
+ if prefix:
+ env.Replace(CC=prefix + 'gcc')
+ env.Replace(CXX=prefix + 'g++')
+ env.Replace(AR=prefix + 'ar')
+ env.Replace(AS=prefix + 'as')
+ env.Replace(LINK=prefix + 'ld')
+ env.Replace(RANLIB=prefix + 'ranlib')
+
+ if tc_path:
+ env.PrependENVPath('PATH', tc_path)
+ sys_root = os.path.abspath(tc_path + '/../')
+ env.AppendUnique(CCFLAGS=['--sysroot=' + sys_root])
+ env.AppendUnique(LINKFLAGS=['--sysroot=' + sys_root])
+
+ if prefix or tc_path:
+ print tc_set_msg
# Ensure scons be able to change its working directory
env.SConscriptChdir(1)
# env.get('SRC_DIR')
# env.get('BUILD_DIR')
+
def __set_dir(env, dir):
- if not os.path.exists(dir + '/SConstruct'):
- print '''
+ if not os.path.exists(dir + '/SConstruct'):
+ print '''
*************************************** Error *********************************
* The directory(%s) seems isn't a source code directory, no SConstruct file is
* found. *
*******************************************************************************
''' % dir
- Exit(1)
+ Exit(1)
+
+ if env.get('RELEASE'):
+ build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/'
+ else:
+ build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
+ env.VariantDir(build_dir, dir, duplicate=0)
+
+ env.Replace(BUILD_DIR=build_dir)
+ env.Replace(SRC_DIR=dir)
- if env.get('RELEASE'):
- build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/'
- else:
- build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
- env.VariantDir(build_dir, dir, duplicate=0)
- env.Replace(BUILD_DIR = build_dir)
- env.Replace(SRC_DIR = dir)
+def __src_to_obj(env, src, home=''):
+ obj = env.get('BUILD_DIR') + src.replace(home, '')
+ if env.get('OBJSUFFIX'):
+ obj += env.get('OBJSUFFIX')
+ return env.Object(obj, src)
-def __src_to_obj(env, src, home = ''):
- obj = env.get('BUILD_DIR') + src.replace(home, '')
- if env.get('OBJSUFFIX'):
- obj += env.get('OBJSUFFIX')
- return env.Object(obj, src)
def __install(ienv, targets, name):
- i_n = ienv.Install(env.get('BUILD_DIR'), targets)
- Alias(name, i_n)
- env.AppendUnique(TS = [name])
+ i_n = ienv.Install(env.get('BUILD_DIR'), targets)
+ Alias(name, i_n)
+ env.AppendUnique(TS=[name])
+
def __append_target(ienv, target):
- env.AppendUnique(TS = [target])
+ env.AppendUnique(TS=[target])
+
def __print_targets(env):
- Help('''
+ Help('''
===============================================================================
Targets:\n ''')
- for t in env.get('TS'):
- Help(t + ' ')
- Help('''
+ for t in env.get('TS'):
+ Help(t + ' ')
+ Help('''
\nDefault all targets will be built. You can specify the target to build:
$ scons [options] [target]
===============================================================================
''')
+
env.AddMethod(__set_dir, 'SetDir')
env.AddMethod(__print_targets, 'PrintTargets')
env.AddMethod(__src_to_obj, 'SrcToObj')
env.AddMethod(__append_target, 'AppendTarget')
env.AddMethod(__install, 'InstallTarget')
env.SetDir(env.GetLaunchDir())
-env['ROOT_DIR']=env.GetLaunchDir()
+env['ROOT_DIR'] = env.GetLaunchDir()
-env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+env.AppendUnique(CPPDEFINES=['TB_LOG'])
if env.get('ROUTING') == 'GW':
- env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
+ env.AppendUnique(CPPDEFINES=['ROUTING_GATEWAY'])
elif env.get('ROUTING') == 'EP':
- env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
-env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+ env.AppendUnique(CPPDEFINES=['ROUTING_EP'])
+env.AppendUnique(CPPDEFINES=['__TIZEN__'])
Export('env')
try:
CC = os.environ['CC']
target_prefix = CC.split()[0]
- target_prefix = target_prefix[:len(target_prefix)-3]
- tools = {"CC" : target_prefix+"gcc",
- "CXX" : target_prefix+"g++",
- "AS" : target_prefix+"as",
- "LD" : target_prefix+"ld",
- "GDB" : target_prefix+"gdb",
- "STRIP" : target_prefix+"strip",
- "RANLIB" : target_prefix+"ranlib",
- "OBJCOPY" : target_prefix+"objcopy",
- "OBJDUMP" : target_prefix+"objdump",
- "AR" : target_prefix+"ar",
- "NM" : target_prefix+"nm",
- "M4" : "m4",
- "STRINGS": target_prefix+"strings"}
+ target_prefix = target_prefix[:len(target_prefix) - 3]
+ tools = {
+ "CC": target_prefix + "gcc",
+ "CXX": target_prefix + "g++",
+ "AS": target_prefix + "as",
+ "LD": target_prefix + "ld",
+ "GDB": target_prefix + "gdb",
+ "STRIP": target_prefix + "strip",
+ "RANLIB": target_prefix + "ranlib",
+ "OBJCOPY": target_prefix + "objcopy",
+ "OBJDUMP": target_prefix + "objdump",
+ "AR": target_prefix + "ar",
+ "NM": target_prefix + "nm",
+ "M4": "m4",
+ "STRINGS": target_prefix + "strings"
+ }
PATH = os.environ['PATH'].split(os.pathsep)
for tool in tools:
if tool in os.environ:
# Delete the temp files of configuration
if env.GetOption('clean'):
- dir = env.get('SRC_DIR')
+ dir = env.get('SRC_DIR')
- if os.path.exists(dir + '/config.log'):
- Execute(Delete(dir + '/config.log'))
- Execute(Delete(dir + '/.sconsign.dblite'))
- Execute(Delete(dir + '/.sconf_temp'))
+ if os.path.exists(dir + '/config.log'):
+ Execute(Delete(dir + '/config.log'))
+ Execute(Delete(dir + '/.sconsign.dblite'))
+ Execute(Delete(dir + '/.sconf_temp'))
Return('env')
print "MQ flag is %s" % with_mq
-env.AppendUnique(CPPFLAGS = ['-std=c++0x', '-fPIC', '-D__TIZEN__','-DWITH_POSIX', '-Wall', '-DSLP_SDK_LOG', '-g','-D_GNU_SOURCE','-DTIZEN_DEBUG_ENABLE', '-DTB_LOG','`pkg-config', '--cflags', '--libs','dlog', 'com.oic.ri', 'capi-network-connection',
- 'gobject-2.0','glib-2.0`'])
+env.AppendUnique(CPPFLAGS=[
+ '-std=c++0x', '-fPIC', '-D__TIZEN__', '-DWITH_POSIX', '-Wall',
+ '-DSLP_SDK_LOG', '-g', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE', '-DTB_LOG',
+ '`pkg-config', '--cflags', '--libs', 'dlog', 'com.oic.ri',
+ 'capi-network-connection', 'gobject-2.0', 'glib-2.0`'
+])
if routing == 'GW':
- env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
+ env.AppendUnique(CPPDEFINES=['ROUTING_GATEWAY'])
elif routing == 'EP':
- env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
+ env.AppendUnique(CPPDEFINES=['ROUTING_EP'])
env.Append(LIBS=[
- 'm', 'pthread', 'rt', 'dl', 'stdc++', 'gobject-2.0', 'gio-2.0', 'glib-2.0', 'capi-network-connection', 'dlog', 'capi-network-bluetooth', 'connectivity_abstraction', 'coap', 'octbstack', 'ocsrm', 'c_common'
+ 'm',
+ 'pthread',
+ 'rt',
+ 'dl',
+ 'stdc++',
+ 'gobject-2.0',
+ 'gio-2.0',
+ 'glib-2.0',
+ 'capi-network-connection',
+ 'dlog',
+ 'capi-network-bluetooth',
+ 'connectivity_abstraction',
+ 'coap',
+ 'octbstack',
+ 'ocsrm',
+ 'c_common',
])
if secured == '1':
- env.PrependUnique(CPPPATH = [root_dir + '/external/inc/'])
- env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
- env.Append(LIBS=['mbedtls', 'mbedx509','mbedcrypto'])
+ env.PrependUnique(CPPPATH=[root_dir + '/external/inc/'])
+ env.AppendUnique(CPPDEFINES=['__WITH_DTLS__'])
+ env.Append(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
if 'ALL' in transport:
- env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER','BT_ADAPTER_TEST','BLE_ADAPTER_TEST'])
- print "CA Transport is ALL"
+ env.AppendUnique(CPPDEFINES=[
+ 'IP_ADAPTER', 'EDR_ADAPTER', 'LE_ADAPTER', 'BT_ADAPTER_TEST',
+ 'BLE_ADAPTER_TEST'
+ ])
+ print "CA Transport is ALL"
else:
- if 'BT' in transport:
- env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER','BT_ADAPTER_TEST'])
- print "CA Transport is BT"
- else:
- env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER'])
-
- if 'BLE' in transport:
- env.AppendUnique(CPPDEFINES = ['LE_ADAPTER','BLE_ADAPTER_TEST'])
- print "CA Transport is BLE"
- else:
- env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER'])
-
- if 'IP' in transport:
- env.AppendUnique(CPPDEFINES = ['IP_ADAPTER'])
- print "CA Transport is IP"
- else:
- env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
-
- if env.get('WITH_TCP'):
- env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER', 'WITH_TCP'])
- else:
- env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+ if 'BT' in transport:
+ env.AppendUnique(CPPDEFINES=['EDR_ADAPTER', 'BT_ADAPTER_TEST'])
+ print "CA Transport is BT"
+ else:
+ env.AppendUnique(CPPDEFINES=['NO_EDR_ADAPTER'])
+
+ if 'BLE' in transport:
+ env.AppendUnique(CPPDEFINES=['LE_ADAPTER', 'BLE_ADAPTER_TEST'])
+ print "CA Transport is BLE"
+ else:
+ env.AppendUnique(CPPDEFINES=['NO_LE_ADAPTER'])
+
+ if 'IP' in transport:
+ env.AppendUnique(CPPDEFINES=['IP_ADAPTER'])
+ print "CA Transport is IP"
+ else:
+ env.AppendUnique(CPPDEFINES=['NO_IP_ADAPTER'])
+
+ if env.get('WITH_TCP'):
+ env.AppendUnique(CPPDEFINES=['TCP_ADAPTER', 'WITH_TCP'])
+ else:
+ env.AppendUnique(CPPDEFINES=['NO_TCP_ADAPTER'])
if 'SUB' in with_mq:
- env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
- print "MQ SUB support"
+ env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
+ print "MQ SUB support"
if 'PUB' in with_mq:
- env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
- print "MQ PUB support"
+ env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
+ print "MQ PUB support"
if 'BROKER' in with_mq:
- env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
- print "MQ Broker support"
+ env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
+ print "MQ Broker support"
#ri_sample_src = [sample_dir + '/occlient.cpp']
#env.Program('ri_sample', [ri_sample_src,])
-env.Program('occlient', [sample_dir + 'occlient.cpp', sample_dir + 'common.cpp'])
-env.Program('ocserver', [sample_dir + 'ocserver.cpp', sample_dir + 'common.cpp'])
-env.Program('ocrouting', [sample_dir + 'ocrouting.cpp', sample_dir + 'common.cpp'])
+sample_comm = sample_dir + 'common.cpp'
+env.Program('occlient', [sample_dir + 'occlient.cpp', sample_comm])
+env.Program('ocserver', [sample_dir + 'ocserver.cpp', sample_comm])
+env.Program('ocrouting', [sample_dir + 'ocrouting.cpp', sample_comm])
with_upstream_libcoap = env.get('WITH_UPSTREAM_LIBCOAP')
if with_upstream_libcoap == '1':
- env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+ env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
else:
- env.AppendUnique(CPPPATH = ['../../../../connectivity/lib/libcoap-4.1.1'])
+ env.AppendUnique(CPPPATH=['../../../../connectivity/lib/libcoap-4.1.1'])
-env.PrependUnique(CPPPATH = [
- '../../../../logger/include',
- '../../../../include',
- '../../../../stack/include',
- '../../../../../oc_logger/include'
- ])
+env.PrependUnique(CPPPATH=[
+ '../../../../logger/include',
+ '../../../../include',
+ '../../../../stack/include',
+ '../../../../../oc_logger/include'
+])
-env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+env.AppendUnique(CPPDEFINES=['TB_LOG'])
if routing == 'GW':
- env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
+ env.AppendUnique(CPPDEFINES=['ROUTING_GATEWAY'])
elif routing == 'EP':
- env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
-env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+ env.AppendUnique(CPPDEFINES=['ROUTING_EP'])
+env.AppendUnique(CPPDEFINES=['__TIZEN__'])
print "Given Transport is %s" % transport
print "Given OS is %s" % target_os
print "Given MQ is %s" % with_mq
if target_os == 'tizen':
- command = "sh resource/csdk/stack/samples/tizen/build/gbsbuild.sh %s %s %s %s %s %s %s %s %s %s" % (transport, secured, buildsample, release_mode, logging, routing, with_tcp, with_proxy, with_mq, target_arch)
- print "Created Command is %s" % command
- gbs_script = env.Command('gbs_build', None, command)
- AlwaysBuild ('gbs_script')
+ command = "./resource/csdk/stack/samples/tizen/build/gbsbuild.sh %s %s %s %s %s %s %s %s %s %s" % (
+ transport, secured, buildsample, release_mode, logging, routing,
+ with_tcp, with_proxy, with_mq, target_arch)
+ print "Created Command is %s" % command
+ gbs_script = env.Command('gbs_build', None, command)
+ AlwaysBuild('gbs_script')
print "Given Transport is %s" % transport
if env.get('RELEASE'):
- env.AppendUnique(CFLAGS = ['-std=c99', '-fPIC', '-D__TIZEN__','-DWITH_POSIX', '-Wall','-D_GNU_SOURCE','-DTIZEN_DEBUG_ENABLE'])
+ env.AppendUnique(CFLAGS=[
+ '-std=c99', '-fPIC', '-D__TIZEN__', '-DWITH_POSIX', '-Wall',
+ '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE'
+ ])
else:
- env.AppendUnique(CFLAGS = ['-std=c99', '-fPIC', '-D__TIZEN__','-DWITH_POSIX', '-Wall', '-DSLP_SDK_LOG', '-g','-D_GNU_SOURCE','-DTIZEN_DEBUG_ENABLE'])
+ env.AppendUnique(CFLAGS=[
+ '-std=c99', '-fPIC', '-D__TIZEN__', '-DWITH_POSIX', '-Wall',
+ '-DSLP_SDK_LOG', '-g', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE'
+ ])
if env.get('LOGGING'):
- env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+ env.AppendUnique(CPPDEFINES=['TB_LOG'])
-env.ParseConfig("pkg-config --cflags --libs capi-network-connection dlog glib-2.0")
+env.ParseConfig(
+ "pkg-config --cflags --libs capi-network-connection dlog glib-2.0")
if env.get('OIC_SUPPORT_TIZEN_TRACE') == 'True':
- env.ParseConfig("pkg-config --cflags --libs ttrace")
- env.AppendUnique(CPPDEFINES = ['OIC_SUPPORT_TIZEN_TRACE'])
+ env.ParseConfig("pkg-config --cflags --libs ttrace")
+ env.AppendUnique(CPPDEFINES=['OIC_SUPPORT_TIZEN_TRACE'])
if 'ALL' in transport:
- env.AppendUnique(CPPDEFINES = ['WIFI_ADAPTER', 'NO_ETHERNET_ADAPTER','EDR_ADAPTER','LE_ADAPTER'])
- print "CA Transport is ALL"
+ env.AppendUnique(CPPDEFINES=[
+ 'WIFI_ADAPTER', 'NO_ETHERNET_ADAPTER', 'EDR_ADAPTER', 'LE_ADAPTER'
+ ])
+ print "CA Transport is ALL"
else:
- if 'BT' in transport:
- env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER'])
- print "CA Transport is BT"
- else:
- env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER'])
+ if 'BT' in transport:
+ env.AppendUnique(CPPDEFINES=['EDR_ADAPTER'])
+ print "CA Transport is BT"
+ else:
+ env.AppendUnique(CPPDEFINES=['NO_EDR_ADAPTER'])
- if 'BLE' in transport:
- env.AppendUnique(CPPDEFINES = ['LE_ADAPTER'])
- print "CA Transport is BLE"
- else:
- env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER'])
+ if 'BLE' in transport:
+ env.AppendUnique(CPPDEFINES=['LE_ADAPTER'])
+ print "CA Transport is BLE"
+ else:
+ env.AppendUnique(CPPDEFINES=['NO_LE_ADAPTER'])
- if 'IP' in transport:
- env.AppendUnique(CPPDEFINES = ['WIFI_ADAPTER'])
- print "CA Transport is WIFI"
- else:
- env.AppendUnique(CPPDEFINES = ['NO_WIFI_ADAPTER'])
+ if 'IP' in transport:
+ env.AppendUnique(CPPDEFINES=['WIFI_ADAPTER'])
+ print "CA Transport is WIFI"
+ else:
+ env.AppendUnique(CPPDEFINES=['NO_WIFI_ADAPTER'])
- if env.get('WITH_TCP'):
- env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER', 'WITH_TCP'])
- else:
- env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+ if env.get('WITH_TCP'):
+ env.AppendUnique(CPPDEFINES=['TCP_ADAPTER', 'WITH_TCP'])
+ else:
+ env.AppendUnique(CPPDEFINES=['NO_TCP_ADAPTER'])
if 'SUB' in with_mq:
- env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
- print "MQ SUB support"
+ env.AppendUnique(CPPDEFINES=['MQ_SUBSCRIBER', 'WITH_MQ'])
+ print "MQ SUB support"
if 'PUB' in with_mq:
- env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
- print "MQ PUB support"
+ env.AppendUnique(CPPDEFINES=['MQ_PUBLISHER', 'WITH_MQ'])
+ print "MQ PUB support"
if 'BROKER' in with_mq:
- env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
- print "MQ Broker support"
+ env.AppendUnique(CPPDEFINES=['MQ_BROKER', 'WITH_MQ'])
+ print "MQ Broker support"
-env.SConscript(['../resource/SConscript'])
+SConscript(env.get('BUILD_DIR') + 'resource/SConscript')
import os
import os.path
-from tools.scons.RunTest import *
+from tools.scons.RunTest import run_test
Import('test_env')
######################################################################
# Build flags
######################################################################
-stacktest_env.PrependUnique(CPPPATH = [
- '../../security/include',
- '../../ocsocket/include',
- '../../logger/include',
- '../../../c_common/ocrandom/include',
- '../../include',
- '../../stack/include',
- '../../stack/include/internal',
- '../../connectivity/api',
- '../../connectivity/inc/pkix',
- '../../connectivity/external/inc',
- '../../../oc_logger/include',
- ])
+stacktest_env.PrependUnique(CPPPATH=[
+ '../../security/include',
+ '../../ocsocket/include',
+ '../../logger/include',
+ '../../../c_common/ocrandom/include',
+ '../../include',
+ '../../stack/include',
+ '../../stack/include/internal',
+ '../../connectivity/api',
+ '../../connectivity/inc/pkix',
+ '../../connectivity/external/inc',
+ '../../../oc_logger/include',
+])
-stacktest_env.PrependUnique(LIBS = ['octbstack_internal',
- 'ocsrm',
- 'routingmanager',
- 'connectivity_abstraction_internal',
- 'coap',
- ])
+stacktest_env.PrependUnique(LIBS=[
+ 'octbstack_internal',
+ 'ocsrm',
+ 'routingmanager',
+ 'connectivity_abstraction_internal',
+ 'coap',
+])
if stacktest_env.get('SECURED') == '1':
- stacktest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509'])
+ stacktest_env.AppendUnique(LIBS=['mbedtls', 'mbedx509'])
# c_common calls into mbedcrypto.
-stacktest_env.AppendUnique(LIBS = ['mbedcrypto'])
+stacktest_env.AppendUnique(LIBS=['mbedcrypto'])
-if 'CLIENT' in rd_mode and target_os not in ['arduino', 'darwin', 'ios', 'windows', 'winrt']:
- stacktest_env.PrependUnique(LIBS = ['oc', 'oc_logger'])
+if 'CLIENT' in rd_mode and target_os not in [
+ 'arduino', 'darwin', 'ios', 'windows', 'winrt'
+]:
+ stacktest_env.PrependUnique(LIBS=['oc', 'oc_logger'])
if 'SERVER' in rd_mode:
if target_os in ['linux', 'tizen']:
stacktest_env.ParseConfig('pkg-config --cflags --libs sqlite3')
elif target_os in ['msys_nt', 'windows']:
- stacktest_env.PrependUnique(LIBS = ['sqlite3'])
+ stacktest_env.PrependUnique(LIBS=['sqlite3'])
if target_os not in ['msys_nt', 'windows']:
- stacktest_env.PrependUnique(LIBS = ['m'])
+ stacktest_env.PrependUnique(LIBS=['m'])
+
if target_os in ['tizen', 'linux']:
- stacktest_env.ParseConfig("pkg-config --cflags --libs gobject-2.0 gio-2.0 glib-2.0")
+ stacktest_env.ParseConfig(
+ "pkg-config --cflags --libs gobject-2.0 gio-2.0 glib-2.0")
######################################################################
# Source files and Targets
stacktest_env.AppendTarget('test')
if stacktest_env.get('TEST') == '1':
if target_os in ['linux', 'windows']:
- run_test(stacktest_env,
- 'resource_csdk_stack_test.memcheck',
- 'resource/csdk/stack/test/stacktests')
- run_test(stacktest_env,
- 'resource_csdk_stack_test.memcheck',
- 'resource/csdk/stack/test/cbortests')
+ run_test(stacktest_env,
+ 'resource_csdk_stack_test.memcheck',
+ 'resource/csdk/stack/test/stacktests')
+ run_test(stacktest_env,
+ 'resource_csdk_stack_test.memcheck',
+ 'resource/csdk/stack/test/cbortests')