#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
Import('env')
import os
import datetime
######################################################################
# Generate iotivity_config.h using presence of headers
######################################################################
-config_h_file_path = os.path.join(src_dir, 'resource', 'c_common', 'iotivity_config.h')
+config_h_file_path = os.path.join(src_dir, 'resource', 'c_common',
+ 'iotivity_config.h')
if (os.path.exists(config_h_file_path)) and (env.GetOption('clean')):
os.remove(config_h_file_path)
if (not os.path.isfile(config_h_file_path)) and (not env.GetOption('clean')):
- conf = Configure(env.Clone(LIBS = []))
+ conf = Configure(env.Clone(LIBS=[]))
config_h_header = '''
/* ****************************************************************************
'''
- cxx_headers = ['arpa/inet.h',
- 'fcntl.h',
- 'grp.h',
- 'in6addr.h',
- 'linux/limits.h',
- 'memory.h',
- 'net/if.h',
- 'netdb.h',
- 'netinet/in.h',
- 'pthread.h',
- 'pwd.h',
- 'stdlib.h',
- 'string.h',
- 'strings.h',
- 'sys/ioctl.h',
- 'sys/poll.h',
- 'sys/select.h',
- 'sys/socket.h',
- 'sys/stat.h',
- 'sys/time.h',
- 'sys/types.h',
- 'sys/unistd.h',
- 'syslog.h',
- 'time.h',
- 'unistd.h',
- 'uuid/uuid.h',
- 'windows.h',
- 'winsock2.h',
- 'ws2tcpip.h']
+ cxx_headers = [
+ 'arpa/inet.h',
+ 'fcntl.h',
+ 'grp.h',
+ 'in6addr.h',
+ 'linux/limits.h',
+ 'memory.h',
+ 'net/if.h',
+ 'netdb.h',
+ 'netinet/in.h',
+ 'pthread.h',
+ 'pwd.h',
+ 'stdlib.h',
+ 'string.h',
+ 'strings.h',
+ 'sys/ioctl.h',
+ 'sys/poll.h',
+ 'sys/select.h',
+ 'sys/socket.h',
+ 'sys/stat.h',
+ 'sys/time.h',
+ 'sys/types.h',
+ 'sys/unistd.h',
+ 'syslog.h',
+ 'time.h',
+ 'unistd.h',
+ 'uuid/uuid.h',
+ 'windows.h',
+ 'winsock2.h',
+ 'ws2tcpip.h'
+ ]
cxx_functions = ['strptime']
cxx_headers.remove('pthread.h')
def get_define_from_string(header_file):
- header_file_converted = header_file.replace("/","_").replace(".","_").upper()
+ header_file_converted = header_file.replace("/", "_").replace(".", "_").upper()
return "HAVE_" + header_file_converted
for header_file_name in cxx_headers:
if conf.CheckCXXHeader(header_file_name):
- config_h_body += "#define %s 1\n\n" % get_define_from_string(header_file_name)
+ config_h_body += "#define %s 1\n\n" % get_define_from_string(
+ header_file_name)
for function_name in cxx_functions:
if conf.CheckFunc(function_name):
- config_h_body += "#define %s 1\n\n" % get_define_from_string(function_name)
+ config_h_body += "#define %s 1\n\n" % get_define_from_string(
+ function_name)
conf.Finish()
# Autoconf feature doesn't work with Jenkins' arduino toolchain, so hardcode it here.
Exit(1)
# iotivity_config.h should be copied to the build dir
-env.UserInstallTargetHeader(config_h_file_path, 'c_common', 'iotivity_config.h')
+env.UserInstallTargetHeader(
+ config_h_file_path, 'c_common', 'iotivity_config.h')
# Use the generated file internally
-env.AppendUnique(CPPPATH = [os.path.join(src_dir, 'resource', 'c_common')])
+env.AppendUnique(CPPPATH=[os.path.join(src_dir, 'resource', 'c_common')])
######################################################################
-env.AppendUnique(CPPPATH = [
+env.AppendUnique(CPPPATH=[
os.path.join(Dir('.').abspath, 'oic_malloc', 'include'),
os.path.join(Dir('.').abspath, 'oic_string', 'include'),
os.path.join(Dir('.').abspath, 'oic_time', 'include'),
os.path.join(Dir('.').abspath, 'octhread', 'include'),
os.path.join(Dir('.').abspath, 'oic_platform', 'include'),
os.path.join(Dir('.').abspath, 'octimer', 'include'),
- '#/extlibs/mbedtls/mbedtls/include'
+ '#/extlibs/mbedtls/mbedtls/include'
])
if target_os not in ['tizen']:
- env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'c_common')])
+ env.AppendUnique(
+ LIBPATH=[os.path.join(env.get('BUILD_DIR'), 'resource', 'c_common')])
if target_os in ['tizen', 'linux']:
env.ParseConfig("pkg-config --cflags --libs uuid")
if env['POSIX_SUPPORTED']:
common_src.append('octhread/src/posix/octhread.c')
-elif target_os in ['windows']:
+elif target_os in ['windows']:
common_src.append('octhread/src/windows/octhread.c')
else:
common_src.append('octhread/src/noop/octhread.c')
# C++ Arduino's <Timer.h> is included so use C++ compiler/flags
if target_os in ['arduino']:
octimer_env = common_env.Clone()
- octimer_env.Replace(CC = env.get('CXX'))
- octimer_env.Replace(CFLAGS = env.get('CXXFLAGS'))
+ octimer_env.Replace(CC=env.get('CXX'))
+ octimer_env.Replace(CFLAGS=env.get('CXXFLAGS'))
octimer = octimer_env.Object('octimer/src/octimer.c')
common_src.append(octimer)
else:
common_src.append('octimer/src/octimer.c')
-common_env.AppendUnique(LIBS = ['logger'])
-common_env.AppendUnique(CPPPATH = ['#resource/csdk/logger/include'])
+common_env.AppendUnique(LIBS=['logger'])
+common_env.AppendUnique(CPPPATH=['#resource/csdk/logger/include'])
commonlib = common_env.StaticLibrary('c_common', common_src)
common_env.InstallTarget(commonlib, 'c_common')
common_env.UserInstallTargetLib(commonlib, 'c_common')
-common_env.UserInstallTargetHeader('iotivity_debug.h', 'c_common', 'iotivity_debug.h')
-common_env.UserInstallTargetHeader('platform_features.h', 'c_common', 'platform_features.h')
+common_env.UserInstallTargetHeader(
+ 'iotivity_debug.h', 'c_common', 'iotivity_debug.h')
+common_env.UserInstallTargetHeader(
+ 'platform_features.h', 'c_common', 'platform_features.h')
Clean(commonlib, config_h_file_path)
# c_common calls into logger.
-env.PrependUnique(LIBS = ['c_common', 'logger'])
+env.PrependUnique(LIBS=['c_common', 'logger'])
import os
import os.path
-from tools.scons.RunTest import *
+from tools.scons.RunTest import run_test
Import('test_env')
# Build flags
######################################################################
-randomtest_env.PrependUnique(CPPPATH = [
- '../include',
- '../../logger/include',
- '../../../oc_logger/include',
- ])
-randomtest_env.PrependUnique(LIBS = ['uuid'])
+randomtest_env.PrependUnique(CPPPATH=[
+ '../include',
+ '../../logger/include',
+ '../../../oc_logger/include',
+])
+randomtest_env.PrependUnique(LIBS=['uuid'])
-randomtest_env.PrependUnique(CPPPATH = ['../include'])
+randomtest_env.PrependUnique(CPPPATH=['../include'])
if target_os in ['linux']:
- randomtest_env.AppendUnique(LIBS = ['m'])
+ randomtest_env.AppendUnique(LIBS=['m'])
if randomtest_env.get('LOGGING'):
- randomtest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+ randomtest_env.AppendUnique(CPPDEFINES=['TB_LOG'])
######################################################################
# Source files and Targets
randomtest_env.AppendTarget('test')
if randomtest_env.get('TEST') == '1':
- if target_os in ['linux', 'windows']:
- run_test(randomtest_env,
- 'resource_csdk_random_test.memcheck',
- 'resource/c_common/ocrandom/test/randomtests')
+ if target_os in ['linux', 'windows']:
+ run_test(randomtest_env, 'resource_csdk_random_test.memcheck',
+ 'resource/c_common/ocrandom/test/randomtests')
import os
import os.path
-from tools.scons.RunTest import *
+from tools.scons.RunTest import run_test
Import('test_env')
######################################################################
# Build flags
######################################################################
-malloctest_env.PrependUnique(CPPPATH = [
- '../include'])
+malloctest_env.PrependUnique(CPPPATH=['../include'])
-malloctest_env.AppendUnique(LIBPATH = [os.path.join(malloctest_env.get('BUILD_DIR'), 'resource', 'c_common')])
-malloctest_env.PrependUnique(LIBS = ['c_common'])
+malloctest_env.AppendUnique(LIBPATH=[
+ os.path.join(malloctest_env.get('BUILD_DIR'), 'resource', 'c_common')
+])
+malloctest_env.PrependUnique(LIBS=['c_common'])
if malloctest_env.get('LOGGING'):
- malloctest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+ malloctest_env.AppendUnique(CPPDEFINES=['TB_LOG'])
#
######################################################################
# Source files and Targets
######################################################################
-malloctests = malloctest_env.Program('malloctests', ['linux/oic_malloc_tests.cpp'])
+malloctests = malloctest_env.Program('malloctests',
+ ['linux/oic_malloc_tests.cpp'])
Alias("test", [malloctests])
malloctest_env.AppendTarget('test')
if malloctest_env.get('TEST') == '1':
- if target_os in ['linux', 'windows']:
- run_test(malloctest_env,
- 'resource_ccommon_malloc_test.memcheck',
- 'resource/c_common/oic_malloc/test/malloctests')
+ if target_os in ['linux', 'windows']:
+ run_test(malloctest_env, 'resource_ccommon_malloc_test.memcheck',
+ 'resource/c_common/oic_malloc/test/malloctests')
import os
import os.path
-from tools.scons.RunTest import *
+from tools.scons.RunTest import run_test
Import('test_env')
######################################################################
# Build flags
######################################################################
-stringtest_env.PrependUnique(CPPPATH = ['../include'])
+stringtest_env.PrependUnique(CPPPATH=['../include'])
-stringtest_env.AppendUnique(LIBPATH = [os.path.join(stringtest_env.get('BUILD_DIR'), 'resource', 'c_common')])
-stringtest_env.PrependUnique(LIBS = ['c_common'])
+stringtest_env.AppendUnique(LIBPATH=[
+ os.path.join(stringtest_env.get('BUILD_DIR'), 'resource', 'c_common')
+])
+stringtest_env.PrependUnique(LIBS=['c_common'])
if stringtest_env.get('LOGGING'):
- stringtest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+ stringtest_env.AppendUnique(CPPDEFINES=['TB_LOG'])
#
######################################################################
# Source files and Targets
######################################################################
-stringtests = stringtest_env.Program('stringtests', ['linux/oic_string_tests.cpp'])
+stringtests = stringtest_env.Program('stringtests',
+ ['linux/oic_string_tests.cpp'])
Alias("test", [stringtests])
stringtest_env.AppendTarget('test')
if stringtest_env.get('TEST') == '1':
if target_os in ['linux', 'windows']:
- run_test(stringtest_env,
- 'resource_ccommon_string_test.memcheck',
- 'resource/c_common/oic_string/test/stringtests')
+ run_test(stringtest_env, 'resource_ccommon_string_test.memcheck',
+ 'resource/c_common/oic_string/test/stringtests')
import os
import os.path
-from tools.scons.RunTest import *
+from tools.scons.RunTest import run_test
Import('test_env')
######################################################################
# Build flags
######################################################################
-timetest_env.PrependUnique(CPPPATH = [
- '../include'])
+timetest_env.PrependUnique(CPPPATH=['../include'])
-timetest_env.AppendUnique(LIBPATH = [os.path.join(timetest_env.get('BUILD_DIR'), 'resource', 'c_common')])
-timetest_env.PrependUnique(LIBS = ['c_common'])
+timetest_env.AppendUnique(LIBPATH=[
+ os.path.join(timetest_env.get('BUILD_DIR'), 'resource', 'c_common')
+])
+timetest_env.PrependUnique(LIBS=['c_common'])
if timetest_env.get('LOGGING'):
- timetest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+ timetest_env.AppendUnique(CPPDEFINES=['TB_LOG'])
#
######################################################################
# Source files and Targets
timetest_env.AppendTarget('test')
if timetest_env.get('TEST') == '1':
if target_os in ['linux', 'windows']:
- run_test(timetest_env,
- 'resource_ccommon_time_test.memcheck',
- 'resource/c_common/oic_time/test/timetests')
+ run_test(timetest_env, 'resource_ccommon_time_test.memcheck',
+ 'resource/c_common/oic_time/test/timetests')
# Include any headers that might be missing on Windows
header = os.path.abspath('./include')
-env.AppendUnique(CPPPATH = [header])
-common_env.AppendUnique(CPPPATH = [header])
+env.AppendUnique(CPPPATH=[header])
+common_env.AppendUnique(CPPPATH=[header])
######################################################################
# Source files and Targets
######################################################################
src_dir = Dir('src').abspath
helper_src = [
- os.path.join(src_dir, 'getopt.c'),
- os.path.join(src_dir, 'memmem.c'),
- os.path.join(src_dir, 'win_sleep.c'),
- os.path.join(src_dir, 'snprintf.c'),
- os.path.join(src_dir, 'pthread_create.c')
- ]
+ os.path.join(src_dir, 'getopt.c'),
+ os.path.join(src_dir, 'memmem.c'),
+ os.path.join(src_dir, 'win_sleep.c'),
+ os.path.join(src_dir, 'snprintf.c'),
+ os.path.join(src_dir, 'pthread_create.c')
+]
win_helper_env = common_env.Clone()
-win_helper_env.AppendUnique(CPPPATH = ['#resource/csdk/logger/include'])
+win_helper_env.AppendUnique(CPPPATH=['#resource/csdk/logger/include'])
static_libwinhelper = win_helper_env.StaticLibrary('win_helper', helper_src)
win_helper_env.InstallTarget(static_libwinhelper, 'win_helper')
win_helper_env.UserInstallTargetLib(static_libwinhelper, 'win_helper')
-win_helper_env.UserInstallTargetHeader('include/memmem.h', 'c_common/windows/include', 'memmem.h')
-win_helper_env.UserInstallTargetHeader('include/win_sleep.h', 'c_common/windows/include', 'win_sleep.h')
-win_helper_env.UserInstallTargetHeader('include/pthread_create.h', 'c_common/windows/include', 'pthread_create.h')
-win_helper_env.UserInstallTargetHeader('include/vs12_snprintf.h', 'c_common/windows/include', 'vs12_snprintf.h')
+win_helper_env.UserInstallTargetHeader(
+ 'include/memmem.h', 'c_common/windows/include', 'memmem.h')
+win_helper_env.UserInstallTargetHeader(
+ 'include/win_sleep.h', 'c_common/windows/include', 'win_sleep.h')
+win_helper_env.UserInstallTargetHeader(
+ 'include/pthread_create.h', 'c_common/windows/include', 'pthread_create.h')
+win_helper_env.UserInstallTargetHeader(
+ 'include/vs12_snprintf.h', 'c_common/windows/include', 'vs12_snprintf.h')
helper_lib = ['win_helper']
-env.AppendUnique(LIBS = helper_lib)
-common_env.AppendUnique(LIBS = helper_lib)
+env.AppendUnique(LIBS=helper_lib)
+common_env.AppendUnique(LIBS=helper_lib)
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
import os.path
-from tools.scons.RunTest import *
+from tools.scons.RunTest import run_test
Import('test_env')
######################################################################
# Build flags
######################################################################
-c_common_windows_test_env.PrependUnique(CPPPATH = ['../include'])
+c_common_windows_test_env.PrependUnique(CPPPATH=['../include'])
-c_common_windows_test_env.AppendUnique(LIBPATH = [os.path.join(c_common_windows_test_env.get('BUILD_DIR'), 'resource', 'c_common')])
-c_common_windows_test_env.PrependUnique(LIBS = ['win_helper'])
+c_common_windows_test_env.AppendUnique(LIBPATH=[
+ os.path.join(
+ c_common_windows_test_env.get('BUILD_DIR'), 'resource', 'c_common')
+])
+c_common_windows_test_env.PrependUnique(LIBS=['win_helper'])
if c_common_windows_test_env.get('LOGGING'):
- c_common_windows_test_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+ c_common_windows_test_env.AppendUnique(CPPDEFINES=['TB_LOG'])
######################################################################
# Source files and Targets
######################################################################
-c_common_windows_tests = c_common_windows_test_env.Program('c_common_windows_tests', ['snprintf_test.cpp'])
+c_common_windows_tests = c_common_windows_test_env.Program(
+ 'c_common_windows_tests', ['snprintf_test.cpp'])
Alias("test", [c_common_windows_tests])