Including tinyusb in a custom cmake project

adrians
Posts: 3
Joined: Mon Jun 18, 2018 11:05 am

Including tinyusb in a custom cmake project

Postby adrians » Tue Oct 10, 2023 10:05 am

Hi,

I am in the process of updating an open-source project from esp_idf v4.4.5 to release v5.1.1 and I would like some advice on the best way to include a component from the component registry as the project uses Tinyusb which is no longer a core component.

The project is a custom cmake project which uses esp-idf.

The latest documentation doesn't include any details on how to do this and the examples don't include a component from the component registry. See:->https://docs.espressif.com/projects/esp ... -projects.

I hope someone can help.

adrians
Posts: 3
Joined: Mon Jun 18, 2018 11:05 am

Re: Including tinyusb in a custom cmake project

Postby adrians » Mon Oct 23, 2023 9:54 am

Can any of the espressif guys help ?

So given the example cmake shown in the documentation how would add registry components like tiny_usb. As adding them to idf_build_process() doesn't find them and having an idl_components.yml doesn't seem to help. Also with a custom cmake project you would want to control where the components are downloaded.

Code: Untitled.cmake Select all


cmake_minimum_required(VERSION 3.16)
project(my_custom_app C)

# Include CMake file that provides ESP-IDF CMake build system APIs.
include($ENV{IDF_PATH}/tools/cmake/idf.cmake)

# Include ESP-IDF components in the build, may be thought as an equivalent of
# add_subdirectory() but with some additional processing and magic for ESP-IDF build
# specific build processes.
idf_build_process(esp32)

# Create the project executable and plainly link the newlib component to it using
# its alias, idf::newlib.
add_executable(${CMAKE_PROJECT_NAME}.elf main.c)
target_link_libraries(${CMAKE_PROJECT_NAME}.elf idf::newlib)

# Let the build system know what the project executable is to attach more targets, dependencies, etc.
idf_build_executable(${CMAKE_PROJECT_NAME}.elf)

Who is online

Users browsing this forum: Google [Bot] and 7 guests