Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cmake Build] How to add additional source and include paths ? #357

Open
popsUlfr opened this issue Jun 11, 2024 · 2 comments
Open

[Cmake Build] How to add additional source and include paths ? #357

popsUlfr opened this issue Jun 11, 2024 · 2 comments
Labels

Comments

@popsUlfr
Copy link

popsUlfr commented Jun 11, 2024

Hello,

I found a forum thread that pinpoints this problem but it doesn't let me reply to it so I'm posting this here

https://community.renesas.com/mcu-mpu/ra/f/forum/34016/adding-additional-source-path-and-include-path-to-visual-studio-code-build-extension

I'm running into this issue even for the RA examples that have multiple subfolders in the src/ directory.
These sub folders don't get taken into account in the cmake source files when generating the configuration.

Modifying the cmake/GeneratedSrc.cmake file and adding the paths is a solution but it gets overwritten each time the configuration is regenerated.

The src/ folder in our project looks like this to separate concerns:

driver/
hci/
motor/
hal_entry.c

The contents of driver/, hci/, motor/ don't get taken into account as source and include folders in the cmake build.

There's a buildinfo.json with

  "sourcePaths": [
    "ra",
    "ra_gen",
    "src"
  ],
  "excludedFilePaths": [],
  "includePaths": [
    "ra/arm/CMSIS_5/CMSIS/Core/Include",
    "ra/fsp/inc",
    "ra/fsp/inc/api",
    "ra/fsp/inc/instances",
    "ra_cfg/fsp_cfg",
    "ra_cfg/fsp_cfg/bsp",
    "ra_gen",
    "src"
  ],

But changing anything here doesn't do anything. The file gets overwritten to defaults on configuration regeneration.

EDIT:

I wanted to amend this with a correction: source files under src/ actually do get picked up correctly thanks to GLOB_RECURSE in file(). But target_include_directories() fails to include all subfolders of src/. I can edit cmake/GeneratedSrc.cmake manually and add them like this:

target_include_directories(${PROJECT_NAME}.elf
    PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/ra/arm/CMSIS_5/CMSIS/Core/Include
    ${CMAKE_CURRENT_SOURCE_DIR}/ra/fsp/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/ra/fsp/inc/api
    ${CMAKE_CURRENT_SOURCE_DIR}/ra/fsp/inc/instances
    ${CMAKE_CURRENT_SOURCE_DIR}/ra_cfg/fsp_cfg
    ${CMAKE_CURRENT_SOURCE_DIR}/ra_cfg/fsp_cfg/bsp
    ${CMAKE_CURRENT_SOURCE_DIR}/ra_gen
    ${CMAKE_CURRENT_SOURCE_DIR}/src/driver
    ${CMAKE_CURRENT_SOURCE_DIR}/src/hci
    ${CMAKE_CURRENT_SOURCE_DIR}/src/motor
    ${CMAKE_CURRENT_SOURCE_DIR}/src
    ${CMAKE_CURRENT_SOURCE_DIR}
)

And it finds everything without issue. But on the next regeneration the file will be overwritten.

@renesas-brandon-hussey
Copy link
Collaborator

This is being internally tracked using FSPRA-3302.

@popsUlfr
Copy link
Author

Thanks. I added a correction to my earlier post. Source files under src/ do get picked up correctly, it's an issue with the missing include directories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants