X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=build_common%2FSConscript;h=ea739b2bbd80d26c27dc7b947f65adfa23c8f029;hb=refs%2Ftags%2Faccepted%2Ftizen%2Funified%2F20230214.171546;hp=4554e039929652baaea9fde3a5c5c98a7e30506e;hpb=ab62c8e15659e1b94259ac95b98e042383fc1cf9;p=platform%2Fupstream%2Fiotivity.git diff --git a/build_common/SConscript b/build_common/SConscript old mode 100644 new mode 100755 index 4554e03..ea739b2 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -6,11 +6,11 @@ import os import platform -project_version = '1.2.0' +project_version = '1.2.1' # Map of host os and allowed target os (host: allowed target os) host_target_map = { - 'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'], + 'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen', 'tizenrt'], 'windows': ['windows', 'android', 'arduino'], 'darwin': ['darwin', 'ios', 'android', 'arduino'], 'msys_nt' :['msys_nt'], @@ -19,14 +19,15 @@ host_target_map = { # Map of os and allowed archs (os: allowed archs) os_arch_map = { 'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'], - 'tizen': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'], + 'tizen': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64', 'riscv64'], 'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'], 'windows': ['x86', 'amd64', 'arm'], 'msys_nt':['x86', 'x86_64'], 'darwin': ['i386', 'x86_64'], 'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'], 'arduino': ['avr', 'arm'], - 'yocto': ['i586', 'i686', 'x86_64', 'arm', 'powerpc', 'powerpc64', 'mips', 'mipsel'], + 'yocto': ['i586', 'i686', 'x86_64', 'arm', 'aarch64', 'powerpc', 'powerpc64', 'mips', 'mipsel'], + 'tizenrt': ['armv7-r', 'armv7-m'], } host = platform.system().lower() @@ -36,8 +37,8 @@ host = platform.system().lower() if 'msys_nt' in host: host = 'msys_nt' -if not host_target_map.has_key(host): - print "\nError: Current system (%s) isn't supported\n" % host +if host not in host_target_map: + print(("\nError: Current system (%s) isn't supported\n" % host)) Exit(1) ###################################################################### @@ -46,7 +47,7 @@ if not host_target_map.has_key(host): 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]) + print(("\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host]))) Exit(1) if target_os == 'android': @@ -79,7 +80,7 @@ else: # targets that do not support the DTLS build (SECURED=1 build option) targets_without_dtls_support = ['arduino']; if ARGUMENTS.get('SECURED') == '1' and target_os in targets_without_dtls_support: - print "\nError: DTLS not supported on target os: %s MUST build with SECURED=0\n" % (target_os) + print(("\nError: DTLS not supported on target os: %s MUST build with SECURED=0\n" % (target_os))) Exit(1) ###################################################################### @@ -95,15 +96,18 @@ help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map help_vars.Add(BoolVariable('WITH_RA', 'Build with Remote Access module', False)) help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False)) +help_vars.Add(BoolVariable('DISABLE_TCP_SERVER', 'Disable TCP server', False)) help_vars.Add(BoolVariable('WITH_PROXY', 'Build with CoAP-HTTP Proxy', False)) help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER'])) help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False)) help_vars.Add(ListVariable('RD_MODE', 'Resource Directory build mode', 'CLIENT', ['CLIENT', 'SERVER'])) +help_vars.Add(BoolVariable('DISABLE_PRESENCE', 'Disable Presence Feature', False)) +help_vars.Add(BoolVariable('DISABLE_BLE_SERVER', 'Disable BLE server', False)) help_vars.Add(BoolVariable('SIMULATOR', 'Build with simulator module', False)) help_vars.Add(BoolVariable('WITH_RA_IBB', 'Build with Remote Access module(workssys)', False)) - +help_vars.Add(BoolVariable('WITH_ASAN', 'Build with Address Sanitizer support', False)) if target_os in targets_disallow_multitransport: help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'IP', ['BT', 'BLE', 'IP', 'NFC'])) @@ -112,9 +116,12 @@ else: help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os])) help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1'))) +help_vars.Add(EnumVariable('WITH_MBEDTLS_STATIC_LIB', 'Build mbedTLS library as static library', '0', allowed_values=('0', '1'))) help_vars.Add(EnumVariable('MULTIPLE_OWNER', 'Enable multiple owner', '0', allowed_values=('0', '1'))) +help_vars.Add(EnumVariable('EXC_PROV_SUPPORT', 'Except OCPMAPI library(libocpmapi.so)', '0', allowed_values=('0', '1'))) help_vars.Add(EnumVariable('TEST', 'Run unit tests', '0', allowed_values=('0', '1'))) help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', logging_default)) +help_vars.Add(EnumVariable('LOG_LEVEL', 'Enable stack logging level', 'DEBUG', allowed_values=('DEBUG', 'INFO', 'ERROR', 'WARNING', 'FATAL'))) help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload)) help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP'))) help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF'))) @@ -123,7 +130,17 @@ help_vars.Add(PathVariable('ANDROID_NDK', 'Android NDK path', None, PathVariable help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept)) help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile)) help_vars.Add(EnumVariable('WITH_UPSTREAM_LIBCOAP', 'Use latest stable version of LibCoAP downloaded from github', default_with_upstream_libcoap, allowed_values=('0','1'))) - +help_vars.Add(EnumVariable('BLE_CUSTOM_ADV', 'Build with CUSTOM Advertisement', 'False', allowed_values=('True', 'False'))) +help_vars.Add(EnumVariable('BLE_DIVISION', 'BLE Build with division code', 'OFF', allowed_values=('OFF', 'MCD', 'VD'))) +help_vars.Add(EnumVariable('BLE_TIZEN_30', 'Build with tizen 3.0 BLE api', 'False', allowed_values=('True', 'False'))) +help_vars.Add(EnumVariable('BLE_TIZEN_40', 'Build with tizen 4.0 BLE api', 'False', allowed_values=('True', 'False'))) +help_vars.Add(EnumVariable('BLE_TIZEN_55', 'Build with tizen 5.5 BLE api', 'False', allowed_values=('True', 'False'))) +help_vars.Add(PathVariable('TIZENRT_OS_DIR', 'Absolute Path to TizenRT OS directory', None, PathVariable.PathAccept)) +help_vars.Add(EnumVariable('PLATFORM_TLS', 'Use platform tls instead of local mbedtls', '0', allowed_values=('0', '1'))) +help_vars.Add(EnumVariable('OIC_SUPPORT_TIZEN_TRACE', 'Tizen Trace(T-trace) api availability', 'False', allowed_values=('True', 'False'))) +help_vars.Add(BoolVariable('WITH_PROCESS_EVENT','Build including process event logics in ocstack', 'False')) +help_vars.Add(BoolVariable('DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY', 'Disable auto-discovery of NSProvider over TCP for TCP connected events', False)) +help_vars.Add(BoolVariable('ENABLE_DUP','Enable duplicate IPv4/IPv6 packets', 'False')) AddOption('--prefix', dest='prefix', type='string', @@ -135,7 +152,7 @@ AddOption('--prefix', ###################################################################### # Platform(build target) specific options: SDK/NDK & toolchain ###################################################################### -targets_support_cc = ['linux', 'arduino', 'tizen'] +targets_support_cc = ['linux', 'arduino', 'tizen', 'tizenrt'] if target_os in targets_support_cc: # Set cross compile toolchain @@ -154,6 +171,17 @@ else: PREFIX = GetOption('prefix'), LIB_INSTALL_DIR = ARGUMENTS.get('LIB_INSTALL_DIR') #for 64bit build ) + +targets_support_gcov = ['linux', 'darwin'] +if target_os in targets_support_gcov: + # Build option to enable coverage checking using gcov. + # Requires gcc or clang family compilers. + # Actual compiler flags need to be set in target-specific script. + help_vars.Add( + BoolVariable('COVERAGE_CHECKS', + 'Build support for running code coverage checks', + default=False)) + Help(help_vars.GenerateHelpText(env)) tc_set_msg = ''' @@ -189,8 +217,11 @@ if target_os in targets_support_cc: env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root]) env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root]) + if target_os == 'tizenrt': + env.PrependENVPath('PATH', os.environ['PATH']) + if prefix or tc_path: - print tc_set_msg + print(tc_set_msg) # If cross-compiling, honor environment settings for toolchain to avoid picking up native tools if os.environ.get('PKG_CONFIG') != None: @@ -213,12 +244,12 @@ env.SConscriptChdir(1) def __set_dir(env, dir): if not os.path.exists(dir + '/SConstruct'): - print ''' + print((''' *************************************** Error ********************************* * The directory(%s) seems isn't a source code directory, no SConstruct file is * found. * ******************************************************************************* -''' % dir +''' % dir)) Exit(1) if env.get('RELEASE'): @@ -335,12 +366,43 @@ if env.get('ROUTING') == 'GW': elif env.get('ROUTING') == 'EP': defines.append('-DROUTING_EP=1') +if env.get('WITH_TCP'): + defines.append('-DTCP_ADAPTER=1') + if env.get('SECURED') == '1': + defines.append('-D__WITH_TLS__=1') + +if env.get('DISABLE_TCP_SERVER'): + defines.append('-DDISABLE_TCP_SERVER=1') + +if env.get('DISABLE_PRESENCE') == False: + env.AppendUnique(CPPDEFINES = ['WITH_PRESENCE']) + +if env.get('DISABLE_BLE_SERVER'): + defines.append('-DDISABLE_BLE_SERVER=1') + +if env.get('WITH_PROCESS_EVENT'): + env.AppendUnique(CPPDEFINES=['WITH_PROCESS_EVENT']) + +if env.get('DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY'): + env.AppendUnique(CPPDEFINES = ['DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY']) + +if env.get('ENABLE_DUP'): + env.AppendUnique(CPPDEFINES = ['ENABLE_DUP']) + +libs = [] +if env.get('SECURED') == '1': + defines.append('-D__WITH_DTLS__=1') + if env.get('EXC_PROV_SUPPORT') == '0': + libs.append('-locpmapi') # CAPI + libs.append('-locprovision') # C++API + pc_vars = { '\@VERSION\@': project_version, '\@PREFIX\@': user_prefix, '\@EXEC_PREFIX\@': user_prefix, '\@LIB_INSTALL_DIR\@': user_lib, - '\@DEFINES\@': " ".join(defines) + '\@DEFINES\@': " ".join(defines), + '\@LIBS\@': " ".join(libs) } env.Substfile(pc_file, SUBST_DICT = pc_vars) @@ -383,7 +445,7 @@ if target_os == "yocto": if os.environ['LDFLAGS'] != None: env.AppendUnique(LINKFLAGS = Split(os.environ['LDFLAGS'])) except: - print "ERROR in Yocto cross-toolchain environment" + print("ERROR in Yocto cross-toolchain environment") Exit(1) ''' Now reset TARGET_OS to linux so that all linux specific build configurations