ucloud-iot-rtthread-package/SConscript

102 lines
3.8 KiB
Python
Raw Normal View History

2020-01-08 14:07:35 +08:00
import os
from building import *
import rtconfig
cwd = GetCurrentDir()
src_base = []
sample_ucloud_mqtt_src = []
sample_ucloud_mqtt_dynamic_auth_src = []
sample_ucloud_shadow_src = []
sample_ucloud_dev_model_src = []
sample_ucloud_ota_src = []
CPPPATH = []
CPPDEFINES = []
LOCAL_CCFLAGS = ''
#include headfile
CPPPATH += [cwd + '/ports/rtthread']
CPPPATH += [cwd + '/ports/ssl']
CPPPATH += [cwd + '/ports/fal']
CPPPATH += [cwd + '/uiot/certs']
CPPPATH += [cwd + '/uiot/dev_model/include']
CPPPATH += [cwd + '/uiot/mqtt/include']
CPPPATH += [cwd + '/uiot/ota/include']
CPPPATH += [cwd + '/uiot/sdk-impl']
CPPPATH += [cwd + '/uiot/shadow/include']
CPPPATH += [cwd + '/uiot/utils']
2020-01-21 18:18:50 +08:00
#Debug
if GetDepend(['PKG_USING_UCLOUD_DEBUG']):
CPPDEFINES += ['ENABLE_LOG_DEBUG', 'ENABLE_LOG_INFO', 'ENABLE_LOG_WARN', 'ENABLE_LOG_ERROR']
2020-01-08 14:07:35 +08:00
#Gen MQTT src file
if GetDepend(['PKG_USING_UCLOUD_MQTT']):
2020-01-21 18:18:50 +08:00
src_base += Glob('uiot/mqtt/src/*.c')
2020-02-24 10:39:33 +08:00
src_base += Glob('uiot/utils/utils_timer.c')
src_base += Glob('uiot/utils/utils_net.c')
src_base += Glob('uiot/utils/utils_list.c')
src_base += Glob('uiot/utils/json_parser.c')
src_base += Glob('uiot/utils/json_token.c')
src_base += Glob('uiot/utils/string_utils.c')
2020-01-21 18:18:50 +08:00
src_base += Glob('ports/rtthread/*.c')
2020-01-08 14:07:35 +08:00
#Gen shadow src file
if GetDepend(['PKG_USING_UCLOUD_SHADOW']):
2020-02-24 10:39:33 +08:00
src_base += Glob('uiot/shadow/src/*.c')
2020-01-08 14:07:35 +08:00
#Gen dev model src file
if GetDepend(['PKG_USING_UCLOUD_DEV_MODEL']):
2020-01-21 18:18:50 +08:00
src_base += Glob('uiot/dev_model/src/*.c')
2020-01-08 14:07:35 +08:00
#Gen ota src file
if GetDepend(['PKG_USING_UCLOUD_OTA']):
2020-01-21 18:18:50 +08:00
src_base += Glob('uiot/ota/src/*.c')
2020-02-24 10:39:33 +08:00
src_base += Glob('ports/fal/*.c')
src_base += Glob('uiot/utils/utils_md5.c')
src_base += Glob('uiot/utils/utils_httpc.c')
2020-01-21 18:18:50 +08:00
2020-01-08 14:07:35 +08:00
#TLS used
if GetDepend(['PKG_USING_UCLOUD_TLS']):
2020-01-21 18:18:50 +08:00
src_base += Glob('uiot/certs/ca.c')
src_base += Glob('ports/ssl/HAL_TLS_mbedtls.c')
CPPDEFINES += ['MBEDTLS_CONFIG_FILE=<HAL_TLS_config.h>']
2020-01-08 14:07:35 +08:00
#Hub C-SDK core
2020-01-08 17:41:14 +08:00
group = DefineGroup('ucloud_iot_sdk', src_base, depend = ['PKG_USING_UCLOUD_IOT_SDK'], CPPPATH = CPPPATH, LOCAL_CCFLAGS = LOCAL_CCFLAGS, CPPDEFINES = CPPDEFINES)
2020-01-08 14:07:35 +08:00
#MQTT Example
if GetDepend(['PKG_USING_UCLOUD_MQTT_SAMPLE']):
2020-01-21 18:18:50 +08:00
sample_ucloud_mqtt_src += Glob('samples/mqtt/mqtt_sample.c')
group = DefineGroup('sample_ucloud_mqtt', sample_ucloud_mqtt_src, depend = ['PKG_USING_UCLOUD_MQTT_SAMPLE'], CPPPATH = CPPPATH, LOCAL_CCFLAGS = LOCAL_CCFLAGS, CPPDEFINES = CPPDEFINES)
2020-01-08 14:07:35 +08:00
#MQTT Dynamic Auth Example
if GetDepend(['PKG_USING_UCLOUD_MQTT_DYNAMIC_AUTH_SAMPLE']):
2020-01-21 18:18:50 +08:00
sample_ucloud_mqtt_dynamic_auth_src += Glob('samples/dynamic_auth/dynamic_auth_sample.c')
group = DefineGroup('sample_ucloud_mqtt_dynamic_auth', sample_ucloud_mqtt_dynamic_auth_src, depend = ['PKG_USING_UCLOUD_MQTT_DYNAMIC_AUTH_SAMPLE'], CPPPATH = CPPPATH, LOCAL_CCFLAGS = LOCAL_CCFLAGS, CPPDEFINES = CPPDEFINES)
2020-01-08 14:07:35 +08:00
#Shadow Example
if GetDepend(['PKG_USING_UCLOUD_SHADOW_SAMPLE']):
2020-01-21 18:18:50 +08:00
sample_ucloud_shadow_src += Glob('samples/shadow/shadow_sample.c')
group = DefineGroup('sample_ucloud_shadow', sample_ucloud_shadow_src, depend = ['PKG_USING_UCLOUD_SHADOW_SAMPLE'], CPPPATH = CPPPATH, LOCAL_CCFLAGS = LOCAL_CCFLAGS, CPPDEFINES = CPPDEFINES)
2020-01-08 14:07:35 +08:00
#Dev Model Example
if GetDepend(['PKG_USING_UCLOUD_DEV_MODEL_SAMPLE']):
2020-01-21 18:18:50 +08:00
sample_ucloud_dev_model_src += Glob('samples/dev_model/dev_model_sample.c')
group = DefineGroup('sample_ucloud_dev_model', sample_ucloud_dev_model_src, depend = ['PKG_USING_UCLOUD_DEV_MODEL_SAMPLE'], CPPPATH = CPPPATH, LOCAL_CCFLAGS = LOCAL_CCFLAGS, CPPDEFINES = CPPDEFINES)
2020-01-08 14:07:35 +08:00
#OTA Example
if GetDepend(['PKG_USING_UCLOUD_OTA_SAMPLE']):
2020-01-21 18:18:50 +08:00
sample_ucloud_ota_src += Glob('samples/ota/ota_sample.c')
group = DefineGroup('sample_ucloud_ota', sample_ucloud_ota_src, depend = ['PKG_USING_UCLOUD_OTA_SAMPLE'], CPPPATH = CPPPATH, LOCAL_CCFLAGS = LOCAL_CCFLAGS, CPPDEFINES = CPPDEFINES)
2020-01-08 14:07:35 +08:00
Return('group')