Hi all
I hve a C project for raspberry pico and I’m trying to organise it properly so it looks legible and decent. I am using the tinyusb library and one of the main ones that is important is tusb_config.h, and after reformatting and cleaning up my code enough I get this error
path/src/tusb_option.h:257:12: fatal error: tusb_config.h: No such file or directory
257 | #include “tusb_config.h”
| ^~~~~~~~~~~~~~~
- Below is the app main source file which uses tusb_config.h and I have included the error using file sets, as recommended in ProfessionalCMake. However, it still isn’t working
add_executable(app_main main.c)
target_sources(app_main
PUBLIC
FILE_SET HEADERS
BASE_DIRS
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/file_processing
${CMAKE_CURRENT_SOURCE_DIR})
## target_include_directories(app_main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/file_processing)
target_link_libraries(app_main PUBLIC file_processing host_storage fatfs_csv)
pico_add_extra_outputs(app_main)
- Below is the subdirectory which includes the tusb_config.h. Also as a side question, do I have to include header files into the add_library command, or can it be only .c files.
set(FATFS_LIB_SOURCES
$ENV{PICO_TINYUSB_PATH}/lib/fatfs/source/ff.c
$ENV{PICO_TINYUSB_PATH}/lib/fatfs/source/ffsystem.c
$ENV{PICO_TINYUSB_PATH}/lib/fatfs/source/ffunicode.c)
set(FATFS_LIB_HEADERS
$ENV{PICO_TINYUSB_PATH}/lib/fatfs/source
)
set(SRC_SOURCES
msc_app.c
)
set(SRC_HEADERS
msc_app.h
tusb_config.h
embedded_cli.h)
add_library(host_storage STATIC
${SRC_SOURCES} ${SRC_HEADERS} ${FATFS_LIB_SOURCES} ${FATFS_LIB_HEADERS}
)
target_sources(host_storage
PUBLIC
FILE_SET HEADERS
BASE_DIRS
${FATFS_LIB_HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}
)
# target_include_directories(host_storage
# PUBLIC
# ${CMAKE_CURRENT_SOURCE_DIR}
# ${FATFS_LIB_HEADERS}
# )
target_link_libraries(host_storage
PUBLIC
tinyusb_host
tinyusb_board
pico_stdlib
)
Any help or advice would be much appreciated
Kind regards