project(GD32F4xx_standard_peripheral LANGUAGES C CXX ASM)

add_library(GD32F4xx_standard_peripheral OBJECT
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_adc.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_can.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_crc.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_ctc.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_dac.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_dbg.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_dci.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_dma.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_enet.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_exmc.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_exti.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_fmc.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_fwdgt.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_gpio.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_i2c.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_iref.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_misc.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_pmu.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_rcu.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_rtc.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_sdio.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_spi.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_syscfg.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_timer.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_tli.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_trng.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_usart.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_wwdgt.c
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Source/gd32f4xx_ipa.c
)

target_include_directories(GD32F4xx_standard_peripheral PUBLIC
    ${CMAKE_SOURCE_DIR}/SDK/GD32F4xx_standard_peripheral/Include
)

target_compile_definitions(GD32F4xx_standard_peripheral PUBLIC GD32F405)

# CMSIS header only library is linked.
target_link_libraries(GD32F4xx_standard_peripheral PUBLIC CMSIS)
