esp-idf/components/tinyusb/CMakeLists.txt
Sudeep Mohanty 4846222102 freertos: update freertos folder structure to match upstream
The following changes have been made:
1. All FreeRTOS kernel source files are now placed in the
   freertos/FreeRTOS-Kernel folder to match with the upstream folder structure.
2. All kernel include files are now placed in freertos/FreeRTOS-Kernel/include.
3. All port files are now placed in freertos/FreeRTOS-Kernel/portable.
4. All additions/customizations are placed in freertos/esp_additions.
5. All other miscellaneous files (README, License files etc.) are moved to
   freertos/FreeRTOS-Kernel folder to match with the upstream.
6. Updated esp-cryptoauthlib to latest commit to resolve FreeRTOS
   include dependencies.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-10-29 12:05:13 +08:00

82 lines
2.7 KiB
CMake

idf_build_get_property(target IDF_TARGET)
set(srcs)
set(includes_public)
set(includes_private)
set(compile_options)
if(CONFIG_TINYUSB)
if(target STREQUAL "esp32s3")
set(tusb_mcu "OPT_MCU_ESP32S3")
set(tusb_family "esp32sx")
elseif(target STREQUAL "esp32s2")
set(tusb_mcu "OPT_MCU_ESP32S2")
set(tusb_family "esp32sx")
else()
# CONFIG_TINYUSB dependency has been garanteed by Kconfig logic,
# So it's not possible that cmake goes here
message(FATAL_ERROR "TinyUSB is not support on ${target}.")
return()
endif()
list(APPEND compile_options
"-DCFG_TUSB_MCU=${tusb_mcu}"
"-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}"
)
idf_component_get_property(freertos_component_dir freertos COMPONENT_DIR)
list(APPEND includes_private
"tinyusb/hw/bsp/"
"tinyusb/src/"
"tinyusb/src/device"
"additions/include_private"
)
list(APPEND includes_public
"tinyusb/src/"
"additions/include"
# The FreeRTOS API include convention in tinyusb is different from esp-idf
"${freertos_component_dir}/FreeRTOS-Kernel/include/freertos"
)
list(APPEND srcs
"tinyusb/src/portable/espressif/${tusb_family}/dcd_${tusb_family}.c"
"tinyusb/src/class/cdc/cdc_device.c"
"tinyusb/src/class/hid/hid_device.c"
"tinyusb/src/class/midi/midi_device.c"
"tinyusb/src/class/msc/msc_device.c"
"tinyusb/src/class/vendor/vendor_device.c"
"tinyusb/src/common/tusb_fifo.c"
"tinyusb/src/device/usbd_control.c"
"tinyusb/src/device/usbd.c"
"tinyusb/src/tusb.c"
"additions/src/descriptors_control.c"
"additions/src/tinyusb.c"
"additions/src/tusb_tasks.c"
"additions/src/usb_descriptors.c"
)
# when no builtin class driver is enabled, an uint8_t data compared with `BUILTIN_DRIVER_COUNT` will always be false
set_source_files_properties("tinyusb/src/device/usbd.c" PROPERTIES COMPILE_FLAGS "-Wno-type-limits")
if(CONFIG_TINYUSB_CDC_ENABLED)
list(APPEND srcs
"additions/src/cdc.c"
"additions/src/tusb_cdc_acm.c"
"additions/src/tusb_console.c"
"additions/src/vfs_tinyusb.c"
)
endif() # CONFIG_TINYUSB_CDC_ENABLED
endif() # CONFIG_TINYUSB
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes_public}
PRIV_INCLUDE_DIRS ${includes_private}
PRIV_REQUIRES "vfs" "usb"
)
if(CONFIG_TINYUSB)
target_compile_options(${COMPONENT_LIB} PRIVATE ${compile_options})
endif()