I have a ESP-IDF cmake project where I renamed the main folder according to this comment: https://github.com/espressif/esp-idf/issues/2801#issuecomment-445626586
The project compiles fine and is displayed correctly until I add a component. Then VisualGDB mixes the source of the new “main folder” (renamed to src) and the component sources. This is just a visual issue, compilation still works fine. I attached a screenshot showing the issue.
This topic was modified 2 weeks, 3 days ago by julianr. Reason: The comment in the fist screenshot is wrong. There is a src folder inside the component
Normally, VisualGDB would display the sources of each component under a corresponding entry in the “Components” view except for the component called “main”. The contents of “main” is shown directly under the project item for convenience.
Based on the screenshots it looks like VisualGDB could not find the main component anymore, so picked up the first component reported by ESP-IDF and merged its contents directly underneath the project view instead.
Normally, we would advise keeping the “main” component name if you decide to move it into a different folder, as it clearly indicates which of the component contains the startup code and makes the project structure easy to read. We could also add an setting that would allow overriding the main component name by editing the XML contents of the .vgdbcmake file, although we would generally advise keeping the main name for readability.
A option like that would be really helpful. In my opinion the name “main” is misleading since there is the complete application code excluding external libraries (which are then inside the components folder).
All my projects usually have a “src” folder where the application code is stored and then some “lib” or “shared” depending on the project. It would be great if I can keep this setup with a ESP-IDF cmake project.
We have added a context menu command “Set as Main Component” to the ESP-IDF component items in Solution Explorer for CMake projects. Flagging an arbitrary component as the “main” one will now merge its contents directly under the top-level item in Solution Explorer.