import rtconfig
from building import *

# get current directory
cwd = GetCurrentDir()

# The set of source files associated with this SConscript file.
cwd = GetCurrentDir()

src = Split('''
RISCV/env_Eclipse/handlers.c
RISCV/env_Eclipse/init.c
RISCV/env_Eclipse/your_printf.c
RISCV/drivers/n200_func.c
GD32VF103_standard_peripheral/system_gd32vf103.c
GD32VF103_standard_peripheral/Source/gd32vf103_gpio.c
GD32VF103_standard_peripheral/Source/gd32vf103_rcu.c
GD32VF103_standard_peripheral/Source/gd32vf103_exti.c
GD32VF103_standard_peripheral/Source/gd32vf103_eclic.c
''')
    
if GetDepend(['RT_USING_SERIAL']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_usart.c']
    
if GetDepend(['RT_USING_I2C']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_i2c.c']

if GetDepend(['RT_USING_SPI']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_spi.c']

if GetDepend(['RT_USING_CAN']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_can.c']

if GetDepend(['BSP_USING_ETH']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_enet.c']

if GetDepend(['RT_USING_ADC']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_adc.c']

if GetDepend(['RT_USING_DAC']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_dac.c']

if GetDepend(['RT_USING_HWTIMER']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_timer.c']

if GetDepend(['RT_USING_RTC']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_rtc.c']
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_pmu.c']

if GetDepend(['RT_USING_WDT']):
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103_wwdgt.c']
    src += ['GD32VF103_standard_peripheral/Source/gd32vf103fwdgt.c']

path = [
    cwd + '/RISCV/drivers',
    cwd + '/GD32VF103_standard_peripheral',
    cwd + '/GD32VF103_standard_peripheral/Include',]

group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path)

Return('group')
