VSCode esp-idf wont link my component folder to project - cmake

I'm trying to create new a folder, where I will keep my components, I already have default components folder (components), but I want to use two or more folders to keep my files sorted. I tried creating new folder (managed_components), adding files but my main file can't find new components folder
I have read, that I need to update my CMakeLists.txt file by adding EXTRA_COMPONENT_DIRS command, but I don't know how it works and can't find any information how to use it, what exactly should I do to tell my main.c file, that there are other component folders in this project and how to link them?

First of all, managed_components directory is used by the IDF Component Manager, so you should come up with a different name.
Secondly, consider if you really need multiple component directories. Do you know that you can have subdirectory for each component inside components directory? For example:
cd components/
idf.py create-component new_component
Finally, if you do want to add extra component directories, then edit the CMakeLists.txt file in the root of your project and add a line like so:
set(EXTRA_COMPONENT_DIRS my_extra_components)
See this example CMakeLists.txt.

Related

Cant create new directory inside existing directory in IntelliJ

Im using IntelliJ community version for Spring project, and I have issue with creating new directory named images inside already existing directory resources -> static. When I right click on static and I add new directory images, instead of creating new directory this is created.
Someone could say that it is ok, this is a way new directory is shown, but I dont think that is correct. When I try to remove images directory I can remove only both directories static.images directory. If I try to add new directory into static directory, it goes into static.images and not into static.
So question is how to create directory inside another directory? There is no issue when I add new package inside another package in the src->main->java project structure.
The other person is correct. The directory was created as you desired, it is just displayed differently that you expected.
To verify this, open a shell and list the directories. The following shows all the directories under the current directory.
$ find . -type d
The directory parent is based on where in the path you click. If you click on the word static you will create a directory under the static directory. If you click on the word images you will create a directory under the images directory.

Can CLion project files be stored in a specified folder by default?

I've been using CLion for a little while now, and I quite like it, except that it stores it's prject files by default in my CMake project. I am wondering if I can set a default place it stores it's project files(like compiled executables) in specific directory, per project.(So not one big folder that might interfere with other projects). The reason I want to do that is because I don't like having it in my git project(yes, I know about .gitignore) Anyone know how to do that?
Thanks!
To use a different folder for CLion building
In the CLion menu:
Build,Execution,Deployment -> Cmake -> Generation Path
Change the value to the folder path you want.
To include source code from a different folder out of current
In your CMakeLists.txt, add subdirectory like following:
add_subdirectory(<PATH_OF_YOUR_ANOTHER_CMAKE_PROJECT>)
Be aware PATH_OF_YOUR_ANOTHER_CMAKE_PROJECT can be anywhere on your computer, which does not have to be in your current project folder or one of the sub-folders.

Why organize projects inside a src folder?

First of all, I would like to make it clear that I know that the src folder is not required. Indeed, one can simply create manually one directory for the project, make one valid project.json and one Startup class and everything should work fine even without Visual Studio.
My point is the following: when we create a new project using ASP.NET 5 from Visual Studio 2015 it creates a solution and inside the solution's folder it creates one src folder. Within this folder all projects are created.
Now why would anyone want to make one src folder inside the solution folder? Why not putting the projects direct onto the solution folder? Is there any advange on the organization of the project to put the projects inside a src folder? Why VS does that now?
You usually have more files inside your project that are not source code related like:
README.md
CONTRIBUTING.md
.gitignore
LICENSE
Build scripts
Docs and tools folders, etc.
And a tons of others files that depend on your configuration. So, if you have a src folder, you don't need to mix your source code files with those.
because you may have your code in src folder (class libraries, etc), test in your test folder, documentation in a documetation folder
in global.json you specify which folders does roslyn pick for compiling.

using Find*.cmake without adding it to cmake modules folder

I want to use FindAntTweakBar.cmake that it becomes able to find the anttweakbar, but I dont have administration access to the cmake's modules folder, so I cannot copy it there. Is there any way to include it and not copy it in the Modules folder? I am using the cmake-gui in the windows.
You can add it to a folder of your choice within your project instead, and modify the CMAKE_MODULES_PATH for that specific project in your CMakeLists.txt.
For instance, if you were to put it into a folder "[location of top-level CMakeLists.txt]/cmake", you would issue:
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake")

How to add non-source folders to IntelliJ IDEA project

Recently set up a multi module project in IntelliJ with the following structure:
/module1
/module2
/web-module
/sql
/lib
/a few more folders
I set up module1+2 and web-module as modules in IntelliJ so those show up, but how do you make the sql and lib folder show up in the project panel? They should be included in VCS as well, but IntelliJ ignores them. How do you add folders outside modules to a project?
Screenshot of project and explorer view:
This is not a strict answer to the question, but it worked for me so I'm posting, perhaps someone will find this useful.
If you want to add an arbitrary folder to your project (even from some different location than your projects), just add it as a module. You needn't worry about the type so much e.g. I needed to add a folder with some SQL scripts, I added it as a Java module and it's nicely visible in IntelliJ even though it has no maven structure or Java sources.
This is how to do it:
File > Project Structure > Modules
Add > New Module > ... (e.g. Java Module)
In the new module settings mark the subfolders that you want to see as 'Sources'
VoilĂ ! :)
This is something that I typically see when creating a project from existing modules. All the modules will show in the project but not the other project related directories. These directories might be, configuration files, environment scripts or bundles of SQL scripts that don't fit neatly into an Intellij module type.
To show the rest of the project source files and directories, I create a parent module from the project root.
File->Project Structure->Modules
Create a new module using the + sign. The new module could be any type (I use java).
On the Next screen set the Content root and Module file location to the Project's root folder.
Select Finish
All of your other modules should now be submodules of the root, and your other project files should now show up.
Add and remove content roots
To add a new content root:
Go to File | Project Structure, or press Ctrl+Shift+Alt+S.
Select Modules under the Project Settings section.
Select the necessary module, and then open the Sources tab in the right-hand part of the dialog.
Click Add Content Root.
Specify the folder that you want to add as a new content root, and click OK.
source: https://www.jetbrains.com/help/idea/creating-and-managing-modules.html
I used File -> New -> Module from Existing Sources...
Then I simply select the folder and add it.
In Project view mode all directories (except the ignored ones from the settings) should show up. Of course the base folder for your multi-project has to be the folder above module1.
EDIT:
Your project should look like this (project view tree):
MY_PROJECT_ROOT (~/the/folder/to/your/project)
|- /module1
|- /module2
|- /web-module
And in this case, you should definitely see the other folders. I got a sample project set up where this is working.
EDIT 2:
From your screenshot, I assume you are missing the root directory (the project root is not as you expected). I added another screenshot. There should be a single root folder for your 3 modules. This one is missing at your screenshot. You have 3 separate folders with no common root folder. On MacOs, the project root is displayed in the window title. In my case it points to ~/devel/sandbox.
I guess you should try to create a new project in for that trunk folder. From the scratch. Then add the existing modules and you should be fine?!