riscv64: Add support for RISC-V
[platform/upstream/iotivity.git] / resource / csdk / connectivity / build / SConscript
index 045faab..946dd49 100644 (file)
@@ -8,21 +8,20 @@ import platform
 # Map of host os and allowed target os (host: allowed target os)
 host_target_map = {
                'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
-               'windows': ['windows', 'winrt', 'android', 'arduino'],
+               'windows': ['windows', 'android', 'arduino'],
                'darwin': ['darwin', 'ios', 'android', 'arduino'],
                }
 
 # Map of os and allowed archs (os: allowed archs)
 os_arch_map = {
                'linux': ['x86', 'x86_64', 'arm', 'arm64'],
-               'tizen': ['x86', 'x86_64', 'arm', 'arm64'],
+               'tizen': ['x86', 'x86_64', 'arm', 'arm64', 'riscv64'],
                'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
                'windows': ['x86', 'amd64', 'arm'],
-               'winrt': ['arm'],
                'darwin': ['i386', 'x86_64'],
                'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
                'arduino': ['avr', 'arm'],
-                'yocto': ['i586', 'x86_64', 'arm', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
+                'yocto': ['i586', 'i686', 'x86_64', 'arm', 'aarch64', 'powerpc', 'powerpc64', 'mips', 'mipsel'],
                }
 
 host = platform.system().lower()
@@ -60,12 +59,16 @@ help_vars = Variables()
 help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
 help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', False))
 help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
-help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP', 'TCP']))
+help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP']))
 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(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')))
+help_vars.Add(BoolVariable('WITH_TCP', 'Enable TCP', False))
+help_vars.Add(BoolVariable('DISABLE_TCP_SERVER', 'Disable TCP server', False))
+help_vars.Add(BoolVariable('DISABLE_BLE_SERVER', 'Disable BLE server', False))
+help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/subscriber/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
 
 help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
 
@@ -151,9 +154,9 @@ def __set_dir(env, dir):
                Exit(1)
 
        if env.get('RELEASE'):
-               build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/'
+               build_dir = os.path.join(dir, 'out', target_os, target_arch, 'release') + os.sep
        else:
-               build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
+               build_dir = os.path.join(dir, 'out', target_os, target_arch, 'debug') + os.sep
        env.VariantDir(build_dir, dir, duplicate=0)
 
        env.Replace(BUILD_DIR = build_dir)
@@ -173,18 +176,17 @@ def __install(ienv, targets, name):
 def __installlib(ienv, targets, name):
        user_prefix = env.get('PREFIX')
        if user_prefix:
-               i_n = ienv.Install(user_prefix + '/lib', targets)
+               install_lib_dir = os.path.join(user_prefix, 'lib')
        else:
-               i_n = ienv.Install(env.get('BUILD_DIR'), targets)
+               install_lib_dir = os.path.join(env.get('BUILD_DIR'), 'lib')
+       i_n = ienv.Install(install_lib_dir, targets)
        ienv.Alias("install", i_n)
 
 def __installbin(ienv, targets, name):
        user_prefix = env.get('PREFIX')
        if user_prefix:
                i_n = ienv.Install(user_prefix + '/bin', targets)
-       else:
-               i_n = ienv.Install(env.get('BUILD_DIR'), targets)
-       ienv.Alias("install", i_n)
+               ienv.Alias("install", i_n)
 
 def __append_target(ienv, target):
        env.AppendUnique(TS = [target])
@@ -272,7 +274,8 @@ if target_os == "yocto":
     env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '__linux__', '_GNU_SOURCE'])
     env.AppendUnique(CFLAGS = ['-std=gnu99'])
     env.AppendUnique(CCFLAGS = ['-Wall', '-fPIC'])
-    env.AppendUnique(LINKFLAGS = ['-ldl', '-lpthread'])
+    if target_os in ['linux']:
+        env.AppendUnique(LIBS = ['dl', 'pthread'])
     Export('env')
 else:
     '''