zephyr/drivers/serial/CMakeLists.txt
Jordan Yates 8e2b2fe595 serial: CONFIG_USB_CDC_ACM adds file to library
It is possible to use the UART abstraction for USB communications
without any of the dedicated UART drivers being enabled. This currently
causes a compilation error because CMake throws an error if a library
has no sources. The empty file forces there to be at least one file in
the library when `CONFIG_USB_CDC_ACM` is enabled.

Removing `select CONFIG_SERIAL_HAS_DRIVER` from `CONFIG_USB_CDC_ACM` is
not a valid solution as this symbol is required by `CONFIG_UART_CONSOLE`
and therefore `USB_UART_CONSOLE`.

Fixes #31067.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-01-04 16:20:43 +01:00

58 lines
2.9 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_UART_ALTERA_JTAG uart_altera_jtag_hal.c)
zephyr_library_sources_ifdef(CONFIG_UART_IMX uart_imx.c)
zephyr_library_sources_ifdef(CONFIG_UART_CC13XX_CC26XX uart_cc13xx_cc26xx.c)
zephyr_library_sources_ifdef(CONFIG_UART_CC32XX uart_cc32xx.c)
zephyr_library_sources_ifdef(CONFIG_UART_CMSDK_APB uart_cmsdk_apb.c)
zephyr_library_sources_ifdef(CONFIG_UART_ESP32 uart_esp32.c)
zephyr_library_sources_ifdef(CONFIG_UART_SIFIVE uart_sifive.c)
zephyr_library_sources_ifdef(CONFIG_UART_GECKO uart_gecko.c)
zephyr_library_sources_ifdef(CONFIG_LEUART_GECKO leuart_gecko.c)
zephyr_library_sources_ifdef(CONFIG_UART_LPC11U6X uart_lpc11u6x.c)
zephyr_library_sources_ifdef(CONFIG_UART_MCUX uart_mcux.c)
zephyr_library_sources_ifdef(CONFIG_UART_MCUX_FLEXCOMM uart_mcux_flexcomm.c)
zephyr_library_sources_ifdef(CONFIG_UART_MCUX_IUART uart_mcux_iuart.c)
zephyr_library_sources_ifdef(CONFIG_UART_MCUX_LPUART uart_mcux_lpuart.c)
zephyr_library_sources_ifdef(CONFIG_UART_MCUX_LPSCI uart_mcux_lpsci.c)
zephyr_library_sources_ifdef(CONFIG_UART_MIV uart_miv.c)
zephyr_library_sources_ifdef(CONFIG_UART_MSP432P4XX uart_msp432p4xx.c)
zephyr_library_sources_ifdef(CONFIG_NRF_UART_PERIPHERAL uart_nrfx_uart.c)
zephyr_library_sources_ifdef(CONFIG_NRF_UARTE_PERIPHERAL uart_nrfx_uarte.c)
zephyr_library_sources_ifdef(CONFIG_UART_NUVOTON uart_nuvoton.c)
zephyr_library_sources_ifdef(CONFIG_UART_SAM uart_sam.c)
zephyr_library_sources_ifdef(CONFIG_USART_SAM usart_sam.c)
zephyr_library_sources_ifdef(CONFIG_UART_STELLARIS uart_stellaris.c)
zephyr_library_sources_ifdef(CONFIG_UART_STM32 uart_stm32.c)
zephyr_library_sources_ifdef(CONFIG_UART_SAM0 uart_sam0.c)
zephyr_library_sources_ifdef(CONFIG_UART_PSOC6 uart_psoc6.c)
zephyr_library_sources_ifdef(CONFIG_UART_PL011 uart_pl011.c)
zephyr_library_sources_ifdef(CONFIG_UART_RV32M1_LPUART uart_rv32m1_lpuart.c)
zephyr_library_sources_ifdef(CONFIG_UART_LITEUART uart_liteuart.c)
zephyr_library_sources_ifdef(CONFIG_UART_RTT_DRIVER uart_rtt.c)
zephyr_library_sources_ifdef(CONFIG_UART_XLNX_PS uart_xlnx_ps.c)
zephyr_library_sources_ifdef(CONFIG_UART_XLNX_UARTLITE uart_xlnx_uartlite.c)
zephyr_library_sources_ifdef(CONFIG_UART_XMC4XXX uart_xmc4xxx.c)
zephyr_library_sources_ifdef(CONFIG_UART_NPCX uart_npcx.c)
zephyr_library_sources_ifdef(CONFIG_UART_APBUART uart_apbuart.c)
zephyr_library_sources_ifdef(CONFIG_USB_CDC_ACM ${ZEPHYR_BASE}/misc/empty_file.c)
zephyr_library_sources_ifdef(CONFIG_USERSPACE uart_handlers.c)
if(CONFIG_UART_NS16550)
zephyr_library_sources(uart_ns16550.c)
foreach(NUM RANGE 0 3)
configure_file(
uart_ns16550_port_x.h
${PROJECT_BINARY_DIR}/include/generated/uart_ns16550_port_${NUM}.h
@ONLY
)
endforeach(NUM)
endif()
if(CONFIG_UART_NATIVE_POSIX)
zephyr_library_compile_definitions(NO_POSIX_CHEATS)
zephyr_library_sources(uart_native_posix.c)
endif()