mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
feat(stdio): updated CMakelists.txt to support cmake v2 build system
This commit is contained in:
@@ -16,12 +16,39 @@ idf_component_register(SRCS ${srcs}
|
||||
INCLUDE_DIRS include)
|
||||
|
||||
if(CONFIG_VFS_SUPPORT_IO)
|
||||
# These drivers will be pulled in from the vfs driver
|
||||
# This maintains the old behavior of just having to add vfs as a REQUIRES to enable
|
||||
# the desired output driver. When we have requires that depend on kconfig values
|
||||
# this can be refactored to conditionally pull drivers into the build instead
|
||||
# TODO: IDF-13984 - Refactor to conditionally include stdio drivers based on Kconfig values
|
||||
idf_component_optional_requires(PRIVATE vfs esp_driver_uart esp_driver_usb_serial_jtag esp_usb_cdc_rom_console)
|
||||
if(IDF_BUILD_V2)
|
||||
idf_component_include(vfs)
|
||||
|
||||
if(CONFIG_ESP_CONSOLE_UART)
|
||||
idf_component_include(esp_driver_uart)
|
||||
target_link_libraries(${COMPONENT_TARGET} PRIVATE
|
||||
idf::esp_driver_uart
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED)
|
||||
idf_component_include(esp_driver_usb_serial_jtag)
|
||||
target_link_libraries(${COMPONENT_TARGET} PRIVATE
|
||||
idf::esp_driver_usb_serial_jtag
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESP_CONSOLE_USB_CDC)
|
||||
idf_component_include(esp_usb_cdc_rom_console)
|
||||
target_link_libraries(${COMPONENT_TARGET} PRIVATE
|
||||
idf::esp_usb_cdc_rom_console
|
||||
)
|
||||
endif()
|
||||
|
||||
else()
|
||||
# These drivers will be pulled in from the vfs driver
|
||||
# This maintains the old behavior of just having to add vfs as a REQUIRES to enable
|
||||
# the desired output driver. When we have requires that depend on kconfig values
|
||||
# this can be refactored to conditionally pull drivers into the build instead
|
||||
# TODO: IDF-13984 - Refactor to conditionally include stdio drivers based on Kconfig values
|
||||
idf_component_optional_requires(PRIVATE vfs esp_driver_uart esp_driver_usb_serial_jtag esp_usb_cdc_rom_console)
|
||||
|
||||
endif()
|
||||
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE idf::vfs)
|
||||
# Make sure esp_stdio_register gets called at startup stage
|
||||
|
||||
@@ -11,11 +11,22 @@
|
||||
#include "esp_stdio.h"
|
||||
#include <sys/errno.h>
|
||||
#if CONFIG_VFS_SUPPORT_IO
|
||||
|
||||
#if CONFIG_ESP_CONSOLE_USB_CDC
|
||||
#include "esp_vfs_cdcacm.h"
|
||||
#include "esp_private/esp_vfs_cdcacm.h"
|
||||
#include "driver/esp_private/usb_serial_jtag_vfs.h"
|
||||
#include "driver/esp_private/uart_vfs.h"
|
||||
#include "esp_private/usb_console.h"
|
||||
#endif
|
||||
#if CONFIG_ESP_CONSOLE_USB_CDC
|
||||
#include "esp_private/esp_vfs_cdcacm.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
|
||||
#include "driver/esp_private/usb_serial_jtag_vfs.h"
|
||||
#endif
|
||||
#if CONFIG_ESP_CONSOLE_UART
|
||||
#include "driver/esp_private/uart_vfs.h"
|
||||
#endif
|
||||
|
||||
#include "esp_private/startup_internal.h"
|
||||
#include "esp_private/nullfs.h"
|
||||
#endif
|
||||
|
||||
@@ -11,11 +11,16 @@ set(sources "")
|
||||
|
||||
# These are here to pull the misc stdio drivers into the build when using VFS
|
||||
# This maintains the old behavior of just having to add vfs as a REQUIRES to enable
|
||||
# the desired output driver. When we have requires that depend on kconfig values
|
||||
# this can be refactored to conditionally pull drivers into the build instead
|
||||
# TODO: IDF-13984 - Refactor to conditionally include stdio drivers based on Kconfig values
|
||||
# the desired output driver. For the new cmake v2 build system this is no longer
|
||||
# necessary as we can conditionally pull in dependencies.
|
||||
|
||||
list(APPEND pr esp_driver_uart esp_driver_usb_serial_jtag esp_usb_cdc_rom_console)
|
||||
|
||||
if(IDF_BUILD_V2)
|
||||
# Clear driver dependencies in v2, these will be pulled in conditionally by stdio
|
||||
set(pr "")
|
||||
endif()
|
||||
|
||||
list(APPEND sources "vfs.c"
|
||||
"vfs_eventfd.c"
|
||||
"vfs_semihost.c"
|
||||
|
||||
Reference in New Issue
Block a user